Android Question RegexBuilder - dividing the string into parts

Thank you for your response.
I know this can be done for example:
Code: Copy
         dim a,b,c as string

    Dim data As String
    data = "aaa.bbb.ccc
    Dim numbers() As String
    numbers = Regex.Split("\.", data)
    Dim l As List
    l.Initialize2(numbers)
     a=l.Get(0)
     b=l.Get(1)
     c=l.Get(2)

is it possible to do this with this class?
https://www.b4x.com/android/forum/t...uilder-for-regular-expressions.83495/#content

it divides the string into parts but I would like to assign them to variables a, b, c
Code: Copy
dim a,b,c as string
dim str as string= "aaa.bbb.ccc''
Dim rx As RegexBuilder
    For Each s As String In Regex.Split(rx.Initialize.AppendEscaped(".").Pattern, str )
    Log(s)
   Next
 
Last edited:
Upvote 0
you probably end up with more code than your example above it unless you store them in an array/list/map.

by the way... that list is not even needed so you can remove 2 lines there and use a=numbers(0) instead.
 
Upvote 0
The purpose of RegexBuilder is to help you build the pattern. Once you got the pattern you use the regular Regex methods.

Code: Copy
Dim a,b,c As String
Dim data As String = "aaa.bbb.ccc"
Dim builder As RegexBuilder
Dim numbers() As String = Regex.Split(builder.Initialize.AppendEscaped(".").Pattern, data)
Dim l As List
l.Initialize2(numbers)
a=l.Get(0)
b=l.Get(1)
c=l.Get(2)
 
Upvote 0
Dim a,b,c As String
Dim data As String = "aaa.bbb.ccc"
Dim builder As RegexBuilder
Dim numbers() As String = Regex.Split(builder.Initialize.AppendEscaped(".").Pattern, data)
Dim l As List
l.Initialize2(numbers)
a=l.Get(
0)
b=l.Get(
1)
c=l.Get(
2)
Why do you insist on using a list in this case when:
Code: Copy
a=numbers(0)
b=numbers(1)
c=numbers(2)
and uses fewer lines of code.
 
Upvote 0
Back
Top