[Gambas-user] convert string to collection

Fabien Bodard gambas.fr at gmail.com
Thu May 4 14:44:43 CEST 2023


Dim a as string[]
For each s in split(s2)
a=scan(s,"*:*")
cRet[a[0]]=a[1]
Next


Best regards,
Fabien


Le jeu. 4 mai 2023 à 11:43, Bruce Steers <bsteers4 at gmail.com> a écrit :

>
>
> On Thu, 4 May 2023 at 10:38, Bruce Steers <bsteers4 at gmail.com> wrote:
>
>>
>>
>> On Thu, 4 May 2023 at 06:07, Mayost Sharon <sharon at 455.co.il> wrote:
>>
>>> ---------- Original Message -----------
>>> From: Jussi Lahtinen <jussi.lahtinen at gmail.com>
>>> To: Gambas Mailing List <user at lists.gambas-basic.org>
>>> Sent: Thu, 4 May 2023 01:29:36 +0300
>>> Subject: Re: [Gambas-user] convert string to collection
>>>
>>> -- snip --
>>>
>>
>
>> Or maybe it is faster using Mid...
>>
>>   Dim iPos As Integer
>>     For Each s_02 In Split(s_01, Chr(10))
>>       iPos = InStr(s_02, ": ")
>>       col_01.Add(Mid(s_02, iPos + 2)), Mid(s_02, 1, iPos - 1))
>>     Next
>>
>
> oops got an extra ) char there..
> should be
>    col_01.Add(Mid(s_02, iPos + 2), Mid(s_02, 1, iPos - 1))
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230504/46919f47/attachment.htm>


More information about the User mailing list