[Gambas-user] Split Strings

Rob Kudla sourceforge-raindog2 at ...94...
Mon Jan 9 21:30:27 CET 2006


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





More information about the User mailing list