[Gambas-user] Convert string to integer array

Casper casper.labuschagne at ...626...
Sat Dec 24 11:15:14 CET 2016


An elegant solution, one just has to love the Gambas language!

a.Add(i) is the part I overlooked, it takes a while to change one's old habits.

To all, have a Great Christmas. In this part of South Africa there is a
heatwave with temperatures into the high thirties for Christmas.

On 24/12/2016, 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




More information about the User mailing list