I have a String variable and I want to extract the three substrings separeted by ; to three string variables.
String application_command = "{10,12; 4,5; 2}";
I cannot use substring method because this string can be like any of the following or similar patterns also.
String application_command = "{10,12,13,9,1; 4,5; 2}"
String application_command = "{7; 1,2,14; 1}"
The only thing that is common in these patterns is there are three sections separated by ;.
Any insight is much appreciated. Thank you
I think you need a
split-string-into-string-array
function with a custom separator character.There are already several sources on the web and at stackoverflow (e.g. Split String into String array).
You can use this function as follows (with ";" as separator):
EDIT: correct single quotes and add semicolons in the example.