[Gambas-user] Split Strings
Muriel Bodard
abidoo.too at ...11...
Tue Jan 10 18:22:09 CET 2006
Le Lundi 09 Janvier 2006 22:28, Benoit Minisini a écrit :
> On Monday 09 January 2006 21:30, Rob Kudla wrote:
> > On Mon January 9 2006 15:04, Mike Keehan wrote:
> > > >>> IPADDR[0]="192.168.1.10"
> > >
> > > Split can take multiple separators. Try something like this:-
> > > Bits = Split(s1, "[]=")
> > > This produces four Message boxes on Gambas 1.0.13,
> > > Maybe Benoit can tell us why the 3rd. one is blank :)
> >
> > It should be blank. Here are where the splits occur (sorry to
> > people who don't use a fixed width font):
> >
> > IPADDR[0]="192.168.1.10"
> > ^ ^^
> >
> > As you can see, there's nothing but an empty string between the
> > second and third delimiters, so it puts an empty string in the
> > array. Otherwise, it'd make parsing CSV files where there may
> > or may not be a value for every field almost impossible, since
> > you wouldn't know which field had been eliminated.
> >
> > Rob
>
> Split(), in the development version, takes an extra boolean parameter that
> tells him to remove void entries.
>
> You can use also Scan(), this way:
>
> PRINT Scan("IPADDR[0]=\"192.168.1.10\"", "IPADDR[*]=\"*\"").Join(";")
> --> 0;192.168.1.10
>
> Regards,
i think he need soemthing like :
dim ars as string[]
ars = Scan("IPADDR[0]=\"192.168.1.10\"", "*[*]=\"*\"")
ars.remove(0)
print ars.join(";")
so it's valuable for each of he's line with a for each for exemple
regards,
Fabien
More information about the User
mailing list