[Gambas-user] Convert string to integer array

adamnt42 at ...626... adamnt42 at ...626...
Sat Dec 24 11:56:42 CET 2016


On Sat, 24 Dec 2016 11:05:00 +0100
Benoît Minisini <gambas at ...1...> wrote:

> 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
> 
> ------------------------------------------------------------------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today.http://sdm.link/intel
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

Classic!

The sun is just about down now, so I'd better go to sleep before the arrival of St Nick.

Bon natale everyone.

and @Casper, the temp here tomorrow (25th) is expected to be 36C+, which is better than yesterday's forecast of 40C+!!!!!


-- 
B Bruen <adamnt42 at ...3379... (sort of)>




More information about the User mailing list