Android Question String array length

Georgi

Member
Hi, i have string array which changes its length after regex.split.
B4X:
Sub globals
dim components(12) as string
dim string_map as string
end sub

sub get_data
string_map = "1,2,3"
components = Regex.Split(",",string_map)
.....
end sub

For example, if string_map is "1,2,3", components.length is no more 12, but 3 ?
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Please use [code]code here...[/code] tags when posting code.

You don't need to set the length when you declare the array. Regex.Split returns a new array anyway.
B4X:
Sub globals
dim components() as string
dim string_map as string
end sub 

sub get_data
string_map = "1,2,3"
components = Regex.Split(",",string_map)
.....
end sub
 
Upvote 0
Top