aArray = Pm.StringSplit(sString, sDelimiter[, sParams])
|sString||(String) Source string expression.|
|sDelimiter||(String) Separator, i.e. text used to identify substring boundaries.|
single character string - This character will be searched in the source string (in sString) and according to that, the source will be divided into substring array.
The most commonly used separators ";" (semicolon), ":" (colon), " " (space), etc.
"" - Source string (sString) is separated into individual characters. I.e. the lenght of the returned array will be the same as source string.
"#nl" - (new line) Source string (sString) is separated to individual rows.
"#ws" - (white space) Source string (sString) is separated to individual words. I.e. the characters like "space", "new line", "tab", etc. will be used as separators and will not be present in the output substrings.
|sParams||[optional] (String) Additional parameters Entries are in format PmNamedValues, for example count:2;empty:0;|
count:n; - Defines the maximum lenght of returned array.
If the parameter is not set (or the value is -1), then each separator is used for separation. I.e. all substrings are saved into the array.
If the parameter is n positive number then the method returns the maximum number of substrings
If there are less substrings, the returned array is smaller.
If there are more substrings then the substring at the end are not saved into the array.
empty:n; - Defines the way the empty string after the last separator is returned in the array of values.
empty:0; (default) - If the string ends with the separator then the last array item will be an empty substring.
Dim arr1, arr2, sValue
sValue = "Temperature=45;Pressure=1015;Power=569;"
arr1 = Pm.StringSplit(sValue, ";", "empty:1;")
' arr1(0) contains "Temperature=45"
' arr1(1) contains "Pressure=1015"
' arr1(2) contains "Power=569"
' arr1(3) does not exist because the empty string after the last semicolon is not saved ("empty:1;" is set)
arr2 = Pm.StringSplit(arr1(0), "=")
' arr2(0) contains "Temperature"
' arr2(1) contains "45"
var arr1, arr2, sValue;
sValue = "Temperature=45;Pressure=1015;Power=569;";
arr1 = Pm.StringSplit(sValue, ";", "empty:1;");
// arr1.GetItem(3) does not exist because the empty string after the last semicolon is not saved ("empty:1;" is set)