[Gambas-user] Split
Charlie Reinl
Karl.Reinl at ...9...
Sun Nov 22 11:10:40 CET 2009
Am Sonntag, den 22.11.2009, 01:03 -0800 schrieb yuhej:
> Hello,
>
> The Split function baheves strange for me.
> I receive data fon an equipment throu RS232 and I need to extract the
> information from a string.
>
> The data groups are separated by 4 chr(10) character (originally it was 2
> CrLf but when reading in Gambas it became 4 chr(10) - this is also strange).
>
> So I take the string and I use Split(myString, chr(10) & chr(10) & chr(10) &
> chr(10)).
> The result is the same what as I use Split(myString, chr(10)), so the first
> character only:
> 0. item is one data
> 1,2,3. item empty
> 4. item data
> 5, 6, 7. empty
> etc.
>
> To solve the problem I used Replace function to replace the 4 chr(10) with
> only one character and the Split function on the redefined string - so
> finally my code works.
>
> Please let me know if this is a bug, a normal behaviour or I have made a
> mistake when using the Split function.
>
> Regards, Robi
Salut Robi,
file:///usr/local/share/gambas2/help/help/lang/split.html
says :
Split ( String AS String [ , Separators AS String , Escape AS String ,
IgnoreVoids AS Boolean ] )
hope that gambas3 does also.
I think your received data are ending sometimes with a ','
so Split entered an empty Item.
--
Amicalement
Charlie
More information about the User
mailing list