function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AbAb 

Cut string values from a String and put them in a map

Hello,

I have string values which i want to put them in to Map
String a = Element: id, text=abcd, attribute #1:idName=name
map
key = 0, [Value1 = abcd, Value2 = name]
Thanks !
 
Best Answer chosen by Ab
Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that can help you
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm
String s1 = 'hamburger';
System.assertEquals('burger', s1.substring(3));
You can try SubString

 

All Answers

Amit K AAmit K A
I did not get that what you want to save into the map exactly.  can you please elaborate
Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that can help you
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm
String s1 = 'hamburger';
System.assertEquals('burger', s1.substring(3));
You can try SubString

 
This was selected as the best answer
ManojjenaManojjena
Hi Sandrine,
Substring will not help here ,substring will give a sinle piece of string ,not a list of string .Here you need to collect a list of string as per you requirment .

I think it is not the exact requirment can you explain with your actual requirment so taht we can help you .

Thanks
Manoj