I have a file of what I will loosely describe as strings delimited by a “special value”. We all know how to split COMMA or TAB delimited strings. – in my instance I have a string of data that is delimited by HexFF — something like "EVERY#GOOD#BOY#DOES#FINE where the ‘#’ character here represents a Hex FF CHRB(255). Attempting to split the string into an array by this value does not work.
I’ve looked at the source data (even in the Xojo Debugger) and I can see exactly 1 Byte between each word that has the value of a HexFF. I can see my delimiter string variable as also having the value of a single HexFF byte. If I change this value to some other letter like “D” or “O” this string splits as you would expect. My encoding for what it’s worth is set to UTF-8.
Everything else about the file is ordinary text. Linefeed terminated etc. I wanted to leverage the simple one-line solution to split each line by the “special character”. This Hex FF character is “safe” in that it is guaranteed not to exist in the data, unlike the COMMA , TAB, SINGLE and DOUBLE QUOTES, Vertical Bar, etc. I simply want to split a “string” by Hex FF.
I get that maybe this isn’t really a valid “string” since it contains a character not defined in the encoding. – BUT Xojo had no problem READING this character from a FILE into a string. And Xojo had no problem with me setting a string variable to CHRB(255) — so… why doesn’t it just split the string by the byte value I sent in? Thoughts?
8 posts - 6 participants