[Gambas-user] simple replace question
Rolf-Werner Eilert
eilert-sprachen at ...221...
Wed Mar 4 15:34:29 CET 2009
Bruce schrieb:
> On Wednesday 04 March 2009 23:00:00 Stefano Palmeri wrote:
>
>> Strange. replace(st,"½",".5") works on my system.
>>
>> Gambas 2.11.1
>>
>> Saluti,
>>
>> Stefano
>
> Damn! And I still can't get it working. The only thing I've been able to
> decipher is that Len(st)=4 not 3. Using gambas 2.9.?? as its the latest
> available for PCLinuxOS (see below).
>
The version will not matter, I guess. Try converting your string into
ASCII before replacing:
newString = Conv(st, "UTF-8", "ASCII")
Replace(st, "½", ".5")
On my old ASCII-table ½ is chr$(171). So it should work with this one,
as it's known in ASCII.
If you get an error 32, your string wasn't UTF-8. Next idea: use
String.Code to find out the Hex-code of each single character in "st".
Then rewrite the replace function for this combination of characters -
something like Replace(st, chr$(30) & chr$(1) & chr$(123), ".5")...
Hope it helps...
Rolf
More information about the User
mailing list