[Gambas-devel] gb3 Split() problem
Kadaitcha Man
nospam.nospam.nospam at ...176...
Mon Jan 4 04:25:17 CET 2010
Gb3 does not correctly split when the separator is a "\r\n" combination:
Dim aText As String
Dim bText As String
Dim aLines As String[]
Dim bLines As String[]
aText = File.Load("Text1")
bText = Replace(aText, "\n", "\r\n")
aLines = Split(aText, "\n")
bLines = Split(bText, "\r\n")
The gb3 documentation states, "Separators is a list of sperators
characters", and one of the examples given uses " \n", however gb3
does correctly split a "\r\n" combination. Instead, gb3 returns an
extra void. Using the IgnoreVoid parameter is not an option because
the code is dealing with RFC 3977 compliant data, which uses
"\r\n\r\n" to signify paragraph marks; using IgnoreVoid means that the
paragraph marks are completely lost and cannot be reconstructed.
Screenshot-aLines (String[]).png shows the expected result for:
bLines = Split(bText, "\r\n")
Screenshot-bLines (String[]).png shows the actual result.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot-aLines (String[]).png
Type: image/png
Size: 20107 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20100104/f0c47135/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot-bLines (String[]).png
Type: image/png
Size: 22415 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20100104/f0c47135/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SplitTest.tar.gz
Type: application/x-gzip
Size: 8982 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20100104/f0c47135/attachment.bin>
More information about the Devel
mailing list