Log In  


Hello,

while trying to compact code to save tokens I ran into an issue when trying to use split with strings containing escaped numbers \0, \1, etc.. (to store binary data that will be converted with ord()

s="abc\0def ghijkl"
split(s," ")

This seems to stop at \0 and the string part after " " will not be in the resulting table.

Is this intended behavior or a bug? With other escaped characters as \n \r \t the splitting works fine.

If this could be possible it would help me save additional tokens.

Thank you,

TheRoboZ

1


"\0" is the "string-end-mark", so it seems, that split does what it should.


it does it with any number after \ and it's a bit inconsistent with the way you can use the string in ord() so I'd like a confirmation from @zep


1

\0 is no longer end string for unicode - so agree with TheRoboz that it should not stop


1

btw sub() seems to have a problem with /0 too

?sub("a\0b",1,1) --work
?sub("a\0b",2,2) -- dont work - output nothing
?sub("a\0b",1,3) --dont work - output nothing
?sub("a\0b",3,3) -- work



[Please log in to post a comment]