[Gambas-user] Unable to split string containing ascii characters

Bruce Bruen bbruen at ...2308...
Mon Jun 6 13:44:26 CEST 2011


On 06/06/11 09:25, Caveat wrote:
> You're asking the wrong question.  What you meant to ask was whether
> anyone thought it necessary to include that functionality in the
> language itself.
>
> Splitting your string on "AE" is easily done, for example:
>
>    DIM aString AS String
>    DIM strings AS String[]
>    aString =
> "AE300AE318AE65AEBuddiesAE302AE319AE300AE319AE7AEclassybabe27_742AE301AE319AE303AE319AE301AE318AE300AE318AE65AEFriendsAE302AE319AE300AE319AE7AEleet.spikeAE301AE319AE303AE319AE301AE318AE303AE318AEAE300AE312AE313AE2AE314AE0AE301AE312AE300AE312AE313AE6AE314AE - 1 AE301AE312AE300AE312AE313AE4AE314AE0AE301AE312AE300AE312AE313AE8AE314AE1AE301AE312AE300AE312AE313AE9AE314AE900AE301AE312AE303AE312AE"
>    aString = Replace(aString, "AE", "{")
>    strings = Split(aString, "{")
>    FOR EACH aString IN strings
>      PRINT aString
>    NEXT
>
> We are a friendly bunch here on the Gambas user list, please try and
> keep it that way, even if sometimes a particular problem frustrates you.
>
> Also please don't forget that the Gambas language is a labour of love
> and that it's FREE, before you ask for your money back ;-)
>
> Kind regards,
> Caveat
>    

One thing that I have found helpful (as in making the code more robust) 
is to use one of the  older and mainly obsolete lower invisible ASCII 
characters (e.g "RS" or "FS" i.e. Chr()'s 28-31 )  as the replacement 
delimiter, they have less chance of showing up in an externally supplied 
string.






More information about the User mailing list