
PRO
ptp
USA
Asked
— Edited

This code works as expected:Code:
1: ClearVariables()
2: $Statement = "one,two,three"
3: $token1 = Split($Statement, ",", 0)
4: $token2 = Split($Statement, ",", 1)
5: $token3 = Split($Statement, ",", 2)
The code below does not work:Code:
1: ClearVariables()
2: $Statement = "one two three"
3: $token1 = Split($Statement, " ", 0)
4: $token2 = Split($Statement, " ", 1)
5: $token3 = Split($Statement, " ", 2)
Line 3 is executed but does not get the token "one" and line 4 generated the error:
Quote:
Error on line 4: Error splitting 'one two three' with SplitChar: '' to field #1. Index was outside the bounds of the array.
Yes and no. Yes in that you are correct that there is a comma in one example and a space in the next example and that is why it is not working. But no, because it should still work with a space between the words instead of a comma. As long as you use a space character in the Split() function instead of the comma it should work the same. So, DJ is checking out why the space character separator is not working.
(i'm having a productive flight home)