Hi,
I need to create substrings, do some checks based on these strings and then recalculate something.
I'm a bit stuck with the string conversion.
The input is an list containing 2 lists looks as following:
We have D+_bl ; a+/D+_bl+ ; a as the first string
This needs to be split into 2 strings, everything before / and everything after /.
then the string needs to be split on ; sign
Then the string needs to be split on _ sign, if available.
I have the following code, but it seems that the regex.split function does not add the split strings to the list as a string.
what am I missing?
logfile output, instead of (ArrayList) [[Ljava.lang.String;@4501fed0] I was expecting to see a substring.
can someone please help me?
I need to create substrings, do some checks based on these strings and then recalculate something.
I'm a bit stuck with the string conversion.
The input is an list containing 2 lists looks as following:
B4X:
(ArrayList) [[D+_bl ; a+/D+_bl+ ; a, D+_bl ; a+/D+_bl+ ; a+, D+_bl+ ; a+/D+_bl+ ; a, D+_bl+ ; a+/D+_bl+ ; a+, D_bl ; a+/D+_bl+ ; a, D_bl ; a+/D+_bl+ ; a+, D_bl+ ; a+/D+_bl+ ; a, D_bl+ ; a+/D+_bl+ ; a+], [21.5, 21.5, 3.5, 3.5, 3.5, 3.5, 21.5, 21.5]]
This needs to be split into 2 strings, everything before / and everything after /.
then the string needs to be split on ; sign
Then the string needs to be split on _ sign, if available.
I have the following code, but it seems that the regex.split function does not add the split strings to the list as a string.
what am I missing?
B4X:
Sub convert_mut_string( input As List) As List
Dim output As List
Dim mutstring As List
Dim mutpercent As List
output.Initialize
mutstring.Initialize
mutpercent.Initialize
mutstring = input.Get(0)
mutpercent = input.Get(1)
For Each S As String In mutstring
Dim b, b2, b3, b4, b5 As List 'buffers
b.Initialize 'used for
b2.Initialize
b3.Initialize
b.AddAll(Regex.Split("/", S)) 'result can only be 2 strings.
b2.AddAll( Regex.Split("_", Regex.Split(" ; ", b.Get(0)))) 'this is everything before the / sign
b3.AddAll( Regex.Split("_", Regex.Split(" ; ", b.Get(1)))) 'this is everything after the / sign
Log(b2)
Msgbox(b2, "Output")
Log(b3)
Msgbox(b3, "Output")
'loop through both lists and create new textstring
For i =0 To b2.Size -1
Log (b2.Get(i) &"/"& b3.Get(i))
Select check_visual(b2.Get(i), b3.Get(i)) 'true for visual/DF, false for split/SF, none for Not mutated, intermediate for recombinations
Case "true"
Case "false"
Case "none"
Case "intermediate"
End Select
Next
Next
End Sub
logfile output, instead of (ArrayList) [[Ljava.lang.String;@4501fed0] I was expecting to see a substring.
B4X:
(ArrayList) [[D+_bl*tq/D+_bl+, D+_bl+/D+_bl+, D_bl*tq/D+_bl+, D_bl+/D+_bl+], [7.0, 43.0, 43.0, 7.0]]
(ArrayList) [[Ljava.lang.String;@4500c038]
(ArrayList) [[Ljava.lang.String;@4500c760]
[Ljava.lang.String;@4500c038/[Ljava.lang.String;@4500c760
(ArrayList) [[Ljava.lang.String;@4501fed0]
(ArrayList) [[Ljava.lang.String;@450204e0]
[Ljava.lang.String;@4501fed0/[Ljava.lang.String;@450204e0
(ArrayList) [[Ljava.lang.String;@4504c1e8]
(ArrayList) [[Ljava.lang.String;@4504c7e8]
[Ljava.lang.String;@4504c1e8/[Ljava.lang.String;@4504c7e8
(ArrayList) [[Ljava.lang.String;@44fb15e8]
(ArrayList) [[Ljava.lang.String;@44fa2620]
[Ljava.lang.String;@44fb15e8/[Ljava.lang.String;@44fa2620