I am using StringField() to do this, but the number of spaces before the first word and between each word
makes a difference to the output.
I am hoping that someone would please explain what I am not understanding about the Stringfield function.
Thank You!
Here's my test code:
Code: Select all
;Purebasic 6.11 LTS(Windows-x64)
For k = 1 To 6
Debug "single space between words, k = " + Str(k) + ": " + StringField("Hello I am a splitted string", k, " ")
Next
Debug " "
For k = 1 To 6
Debug "double space between words, k = " + Str(k) + ": " + StringField("Hello I am a splitted string", k, " ")
Next
Debug " "
For k = 1 To 6
Debug "three spaces between words, k = " + Str(k) + ": " + StringField("Hello I am a splitted string", k, " ")
Next
Debug " "
For k = 1 To 6
Debug "one space before 'Hello', k = " + Str(k) + ": " + StringField(" Hello I am a splitted string", k, " ")
Next
Debug " "
For k = 1 To 6
Debug "two spaces before 'Hello', k = " + Str(k) + ": " + StringField(" Hello I am a splitted string", k, " ")
Next

