MrKim Well-Known Member Licensed User Longtime User Sep 18, 2013 #1 So probably the other functions as well. Can anybody confirm this? For safety I was going to use ASCII above 128 to divide my data but it dosn't seem to work. Can anyone confirm this? Is this true of Android in general or B4A in general - High bit characters are not supported? The other day I also noticed split also failed when using ][ as part of a divider. Thanks Kim
So probably the other functions as well. Can anybody confirm this? For safety I was going to use ASCII above 128 to divide my data but it dosn't seem to work. Can anyone confirm this? Is this true of Android in general or B4A in general - High bit characters are not supported? The other day I also noticed split also failed when using ][ as part of a divider. Thanks Kim
M Mahares Expert Licensed User Longtime User Sep 18, 2013 #2 You will have to escape the ][: Code: Copy MyString=Regex.Split("\]\[",MyText) 'need the \slash to escape it as ][ is a special character But your best bet is to do it like this: Code: Copy Dim MyText As String="[New York][Cairo][Zurich]".Replace("[","") Dim MyString() As String MyString=Regex.Split("]",MyText) Msgbox( MyString(0) & " " & MyString(1) & " " & MyString(2),"") 'displays New York Cairo Zurich Upvote 0
You will have to escape the ][: Code: Copy MyString=Regex.Split("\]\[",MyText) 'need the \slash to escape it as ][ is a special character But your best bet is to do it like this: Code: Copy Dim MyText As String="[New York][Cairo][Zurich]".Replace("[","") Dim MyString() As String MyString=Regex.Split("]",MyText) Msgbox( MyString(0) & " " & MyString(1) & " " & MyString(2),"") 'displays New York Cairo Zurich
MrKim Well-Known Member Licensed User Longtime User Sep 23, 2013 #3 I was actually using multiple characters as a separator for fields so I just changed the characters. My real question comes with high bit characters (> ASCII 128) I would prefer to use them, but they do not seem to work at all. I wonder if they can be escaped? Hmmmm. I will test that when I have time. Also, Is there a list of the special characters that need to be escaped. I VBA/Access I more or less know this stuff by heart. I was just looking at your code again - are you saying '][' is the special character but '[' and ']' separately are not? Last edited: Sep 23, 2013 Upvote 0
I was actually using multiple characters as a separator for fields so I just changed the characters. My real question comes with high bit characters (> ASCII 128) I would prefer to use them, but they do not seem to work at all. I wonder if they can be escaped? Hmmmm. I will test that when I have time. Also, Is there a list of the special characters that need to be escaped. I VBA/Access I more or less know this stuff by heart. I was just looking at your code again - are you saying '][' is the special character but '[' and ']' separately are not?
NJDude Expert Licensed User Longtime User Sep 23, 2013 #4 If you are using regex, this is the list of SPECIAL CHARACTERS Upvote 0
MrKim Well-Known Member Licensed User Longtime User Sep 23, 2013 #5 NJDude said: If you are using regex, this is the list of SPECIAL CHARACTERS Click to expand... Perfect, thank you. Upvote 0
NJDude said: If you are using regex, this is the list of SPECIAL CHARACTERS Click to expand... Perfect, thank you.
MrKim Well-Known Member Licensed User Longtime User Sep 24, 2013 #6 Turns out the issue is not with Regex but with File.Readstring and file.ReadText. The are evidently making assumptions about encoding and scrambling my data. I will stick with longer for safety low bit separators unless there is an easy way to read in the binary data. Upvote 0
Turns out the issue is not with Regex but with File.Readstring and file.ReadText. The are evidently making assumptions about encoding and scrambling my data. I will stick with longer for safety low bit separators unless there is an easy way to read in the binary data.
Erel B4X founder Staff member Licensed User Longtime User Sep 25, 2013 #7 These methods assume that UTF8 encoding is used. For other encodings you should work with TextReader. Upvote 0
These methods assume that UTF8 encoding is used. For other encodings you should work with TextReader.