You need to sign in to do that
Don't have an account?
string split based on specified character
Hi All,
I want to split a string based on the character on the string lets say(B, and F)
for example i want to break the string "B001B0002B000005F0006" to a string array like this {"B001", "B0002", "B000005", "F0006" }
how can i do this
Hi Dilu,
Try below code for your requirement.
Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator
Hello Bro,
Nice question.
I have implemented you question and found the solution. Try this code -
string str = 'B001B0002B000005F0006';
list<string> B = new list<string>();
list<string> F = new list<string>();
for(string s : str.split('B'))
{
if(s.contains('F'))
{
F = s.split('F');
system.debug('### F # - '+ s.split('F'));
}
B.add(s);
system.debug('### S # - '+ s);
}
Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You,
Raj Jha