I have a string who I want to get separate (split) but I wish to use both sides of resultant string in different fields in Service Desk. Can u help me how to obtain this?
I have the original string variable as:
twostrings = Consult ticket_ 02;
//and the function split as:
split(resume, twostrings, "_");
So the result it will be:
resume = Consult ticket;
But if I want to use the other part of the split result: 02, how I do it?
Thanks for the help.
As far as I rememember split work differently in spel:
the split function expect three arguments:
it returns the number of parts split was able to find.
In your case it might look as
int num_found;string twostrings;twostrings ="Consult ticket_ 02";string resume;num_found=split(resume, twostrings, "_");// num_found = 2// resume will contain "Consult ticket"// resume contains " 02"
The only bad thing here: You need to know the expected maximum number of parts , before splitting. To be able, to declare the Array appropriately.
Thanks a lot for the response.
It helped me to solve the problem I got in order to obtain the other side of the string with the split action.