You need to sign in to do that
Don't have an account?
Siddharth Mani
Remove a character from String and store the remaining in a list
Hi,
Suppose I have a String like this:
String myString = ';abc;;;def;;ghi;jkl;lmnop';
Is it possible to create a list like {abc,def,ghi,jkl,lmnop} ??
Basically the values will be separated by semicolon, but it might not be a single one and it may also occur at the start and end. I want only the values stored in a separate list
Suppose I have a String like this:
String myString = ';abc;;;def;;ghi;jkl;lmnop';
Is it possible to create a list like {abc,def,ghi,jkl,lmnop} ??
Basically the values will be separated by semicolon, but it might not be a single one and it may also occur at the start and end. I want only the values stored in a separate list
Output will be
------------------>(abc, def, ghi, jkl, lmnop)
All Answers
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm
you can also try replace(target, replacement)
{abc,def,ghi,jkl,lmnop} ----------> This should be the output list with each item being a separate element.
For eg. if "myList" is the variable which contains the output then:
myList[0] = abc
myList[1] = def ..................and so on
Hope its clear now!!
Output will be
------------------>(abc, def, ghi, jkl, lmnop)