Android Question regex split pipe doesnt work

techknight

Well-Known Member
Licensed User
Longtime User
I am using a pipe | as the delimiter in regex split. But its not working.

any ideas?
 

Midimaster

Active Member
Licensed User
why not:
B4X:
Dim str As String = "abc|def|efg"
Dim x() As String = Regex.Split("|", str)
For Each s In x
    Log(s)
Next
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code works correctly. I've just tried it. The output is:
B4X:
Sub Activity_Click
    Dim str As String = "abc|def|efg"
    Dim x() As String = Regex.Split("\|", str)
    For Each s In x
        Log(s)
    Next
End Sub

Copying updated assets files (4)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
abc
def
efg
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
ok ill have to check the string coming from the server then to see if something is wrong with that. Maybe ill need to run some regex thing to clean up non printable characters.
 
Upvote 0
Top