Page 1 of 2

#CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 11:08 am
by MachineCode
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

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 11:21 am
by Shield
Manual wrote: Delimiter$ The string delimiter to use to separte the fields. It can be a multi-characters delimiter.

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 11:24 am
by Danilo
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
14 February 2013 : Version 5.10
- Added: Multicharacter comparison in StringField()
Syntax

Result$ = StringField(String$, Index, Delimiter$)

Description

Returns the string field at the specified index.

Parameters

String$ The string to parse.
Index The field index to return. The first index is 1.
Delimiter$ The string delimiter to use to separate the fields. It can be a multi-characters delimiter.

Example

Code: Select all

  For k = 1 To 6
    Debug StringField("Hello I am a splitted string", k, " ")
  Next
Supported OS

All

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 11:35 am
by ts-soft
But it works with PB4.10+ :wink:

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 11:38 am
by MachineCode
ts-soft wrote:But it works with PB4.10+ :wink:
Interesting! But I'm still using 5.00 at the moment, so I never saw the new manual change. :P

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 11:42 am
by ts-soft
Only tested with your example, so please have attention!

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 11:45 am
by Danilo
ts-soft wrote:But it works with PB4.10+ :wink:
I assume always we talk about latest final, stable versions. If you speak about any older version, it would be helpful to mention it.
Who cares about Version 4.10, it is over 5 years old?

It's considered 'final' and 'stable' if there is no 'beta' in the name. Of course, there will be always new versions, even after 5.11...

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 11:55 am
by MachineCode
Without looking at the manual (since 5.10 is not installed ATM), does LTrim() and RTrim() support multi-character removal too?

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 12:03 pm
by Danilo
MachineCode wrote:Without looking at the manual (since 5.10 is not installed ATM), does LTrim() and RTrim() support multi-character removal too?
LTrim & RTrim v5.10 wrote:'Character$' has to be a one character length string

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 1:00 pm
by ts-soft
Danilo wrote:
ts-soft wrote:But it works with PB4.10+ :wink:
I assume always we talk about latest final, stable versions. If you speak about any older version, it would be helpful to mention it.
Where have you your eyes? PB4.10+ means all Versions, since PB4.10.

MachineCode speaks over <= PB5.00, this can you see, as he mentioned, this is not in the helpfile.

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 1:12 pm
by Danilo
ts-soft wrote:MachineCode speaks over PB5.00, this can you see, as he mentioned, this is not in the helpfile.
"Not in the helpfile" means it is not officially supported by version 5.0 he is using. It is like the new 'string.s + i.i' feature - still experimental (means: not working correctly in all cases) and not mentioned in the manual,
not mentioned in the history.
For serious applications and games development you always should rely exactly on the manuals, whether it is PB, MSDN, Apple Developer Central.
Read the text twice and follow it exactly. Other information are not reliable, it is just trial and error. Just works? Good luck with your business!

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 1:24 pm
by infratec
Hi,

I'm not sure if it works:

#CRLF$ can be detected with the first character #CR
The #LF is not always displayed with Debug.

To test if it works with mutiple charactres you need to test it with something like that:

String: "ABCDEFCDGHIJCDKLMN"
And "CD" as delimiter.

Sorry I can not test it, I removed the old stuff completely :D

Bernd

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 2:00 pm
by c4s
Offtopic:
Danilo wrote:[...] It is like the new 'string.s + i.i' feature - still experimental (means: not working correctly in all cases) and not mentioned in the manual, not mentioned in the history.
Do you mean this feature isn't mentioned? If so, check this out:
PB 5.10 history wrote:- Added: autocast of numeric values when string are involved, allowing to concatenate string and numeric in constants

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 2:39 pm
by Danilo
c4s wrote:Offtopic:
Danilo wrote:[...] It is like the new 'string.s + i.i' feature - still experimental (means: not working correctly in all cases) and not mentioned in the manual, not mentioned in the history.
Do you mean this feature isn't mentioned? If so, check this out:
PB 5.10 history wrote:- Added: autocast of numeric values when string are involved, allowing to concatenate string and numeric in constants
Yes, this is exactly what I meant. It is mentioned in the history in this case (thank you!), ...[removed blah blah]

Re: #CRLF$ as StringField delimiter

Posted: Sat Mar 02, 2013 3:03 pm
by Michael Vogel
As seen in the changelog, the CRLF works from version 5.10 on (and LF has been ignored in all PB versions up to version 5.00)

Code: Select all

a$="123"+#CRLF$+"456"+#CRLF$+"789"

For i=1 To CountString(a$,#CRLF$)+1
	s.s=StringField(a$,i,#CRLF$)
	Debug Str(Asc(s))+" / "+Str(Asc(Trim(s,#LF$)))+" : "+s+" / "+Mid(s,2,3<<4)
Next