The example only appears to work. StringField() only pays attention to the first character of the string it is given.MachineCode wrote:I see in the manual that StringField's delimiter can only be one character. But, this works with #CRLF$. Why?
Code: Select all
Debug Len(#CRLF$) ; Returns 2 a$="123"+#CRLF$+"456"+#CRLF$+"789" For i=1 To CountString(a$,#CRLF$)+1 Debug StringField(a$,i,#CRLF$) Next
To illustrate this, lengthen the string it is given with characters that aren't in the string being examined and compare the results with the example you gave.
Code: Select all
Debug Len(#crlf$) ; Returns 2
a$="123"+#crlf$+"456"+#crlf$+"789"
For i=1 To CountString(a$,#crlf$)+1
Debug StringField(a$,i,#crlf$)
Next
Debug "-------"
For i=1 To CountString(a$,#crlf$)+1
Debug StringField(a$,i,#crlf$ + "hello")
Next