Hi all,
I've used several programming languages in the the past and ususally, when I want to split a string by a certain character, I do something like:
I suppose in every languages I've did something like this, the "concept" is the same...
Now, in B4X, I'm trying to achieve this, without success... What I've tryed:
This snippet, give me a list of three elements (not 5).
I've also trying this, from StringFunctions2:
Also, getting a list of three elements
Is there any way to have the expected result (at least for me) of a list of 5 elements (behing the last two, empty string).
Thanks.
ps - I'm posting in the Android forum section because I don't really know where I should post this doubt of mine.
I've used several programming languages in the the past and ususally, when I want to split a string by a certain character, I do something like:
Perl:
my $string = "one#two#three##";
my @array = split /#/, $string;
print $array[0]; # one
print $array[1]; # two
print $array[2]; # three
print $array[3]; # ""
print $array[4]; # ""
I suppose in every languages I've did something like this, the "concept" is the same...
Now, in B4X, I'm trying to achieve this, without success... What I've tryed:
B4X:
Dim mystring As String = "one#two#three##"
Dim mylist As List
mylist.Initialize
For Each mystrings As String In Regex.split("#", mystring)
mylist.Add(mystrings)
Next
This snippet, give me a list of three elements (not 5).
I've also trying this, from StringFunctions2:
B4X:
Dim mystring As String = "one#two#three##"
mylist = sf.Split(mystring, "#")
Also, getting a list of three elements
Is there any way to have the expected result (at least for me) of a list of 5 elements (behing the last two, empty string).
Thanks.
ps - I'm posting in the Android forum section because I don't really know where I should post this doubt of mine.