[Gambas-user] Convert string to integer array
Benoît Minisini
gambas at ...1...
Sat Dec 24 11:05:00 CET 2016
Le 24/12/2016 à 09:44, Fabien Bodard a écrit :
> Public Sub Main()
>
> Dim s As String
> Dim i As String
> Dim a As New Integer[]
> ''1) with no knowledge of the number of values
> 'init the string
> s = "[12,32,3]"
>
> 'remove unused spaces and braquets
> For Each i In Split(Left(Right(Trim(s), -1), -1))
>
> a.Add(i)
>
> Next
>
>
>
> 'display the array content
> For Each i In a
> Print i
> Next
>
> 2016-12-24 7:29 GMT+01:00 adamnt42 at ...626... <adamnt42 at ...626...>:
>> Baffled!
>>
>> I have a string, like "[1,3]", that I want to populate an integer array from.
>>
>> How to?
>>
>> tia
>>
>> --
>> B Bruen <adamnt42 at ...3379... (sort of)>
>>
Other solution : MyIntegerArray = JSON.Decode(MyString)
:-)
--
Benoît Minisini
More information about the User
mailing list