Page 2 of 2

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 4:35 pm
by Demivec
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
The example only appears to work. StringField() only pays attention to the first character of the string it is given.

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
The results of the two loops match. This shows that StringField() only used the first character of #crlf$ and only the first character of #crlf$ + "hello", both of which is the character #cr$. This result matches the description in the manual (for version 5.00).

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 8:26 pm
by netmaestro
NOBODY HERE seems to have a clue
:?:
At least try to be nice.

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 10:05 pm
by Danilo
netmaestro wrote:
NOBODY HERE seems to have a clue
:?:
At least try to be nice.
Sorry for that! Removed the blah blah.