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

Benoît Minisini gambas at ...1...
Sun Jun 5 21:53:28 CEST 2011


> This is getting ridiculous.
> 
> I have now written a function to strip out all the headers and replace
> all Chr(&C0) and all Chr(&80) (the ascii AE's) with a plain text AE.
> The string is now
> "AE300AE318AE65AEBuddiesAE302AE319AE300AE319AE7AEclassybabe27_742AE301AE319
> AE303AE319AE301AE318AE300AE318AE65AEFriendsAE302AE319AE300AE319AE7AEleet.sp
> ikeAE301AE319AE303AE319AE301AE318AE303AE318AEAE300AE312AE313AE2AE314AE0AE30
> 1AE312AE300
> AE312AE313AE6AE314AE-1AE301AE312AE300AE312AE313AE4AE314AE0AE301AE312AE300A
> E312AE313AE8AE314AE1AE301AE312AE300AE312AE313AE9AE314AE900AE301AE312AE303AE
> 312AE"
> 
> Could someone please explain why then when I Split(thestring, "65AE") I
> get a 161 position array, many of which are empty? Yet again, 65AE only
> occurs 2 times in my string.
> 
> And if I blindly barge through the routine with TRY, I must at a later
> point split the array at "7AE", yet when I encounter the name
> classybabe27_742, I get back classybabe2, _, 42.
> 
> And honestly all this stripping and replacing characters is not a
> preferred solution. It's an ugly hack to a simple problem, that I'm
> sure is going to create problems later in this project. A project I've
> already invested 2 weeks in, and am about to have to scrap if this
> isn't possible.
> 
> Please tell me I'm doing something wrong here, because if this language
> cannot even split a simple string....
> 

As explained in the Split() documentation, the "Separators" argument is a list 
of single ASCII characters, each one being a separator. You cannot split with 
an arbitrary string.

Regards,

-- 
Benoît Minisini




More information about the User mailing list