ptp
USA
Asked
— Edited
Resolved by DJ Sures!
This code works as expected:
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:
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.
I'll look into it
I don't know much about coding but could t have something to do with the comma because the first code has a comma in between one and two and two and three where as the second code does not have a comma on line 2
@Mohamed.r
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.
fixed in next release
(i'm having a productive flight home)
Thanks
Plane just landed - so I'll have the new release up when I get home.