You need to sign in to do that
Don't have an account?
chaithaly gowda
how to convert string into a list
Hi
I have a string which is in format ('abc','xyz','efg').
Can someone please suggest how this string can be converted into list<string> with the value abc,xyz,efg.
Any help would be appreciated.
Thanks
Chaithaly
I have a string which is in format ('abc','xyz','efg').
Can someone please suggest how this string can be converted into list<string> with the value abc,xyz,efg.
Any help would be appreciated.
Thanks
Chaithaly
str = str.replace('(','').replace(')',''); //Taking out ( and )
str = str.replace('\'',''); //Taking out '
List<String> strList = str.split(',');
li = list(string.split(" "))
return li
# Driver code
str1 = "Sales Force"
print(Convert(str1))
Output:
['Sales', 'Force']
Njmcdirect (http://www.paynjmcdirect.com)
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm
EX:-
String str = '123, 456, 789';
List<String> lstString = str.split(',');
System.debug('-----lstString----'+lstString);
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.