Search, Replace and Unicode

Richmond richmondmathewson at gmail.com
Sat Dec 29 10:48:10 EST 2012


Now, of course, the real fun starts when one wants to play around with 
wild-cards so that one can, say,

swap Z and X around in a unicodeText field that contains stuff like this:

ZaXddZfXabcdeZoX

as I am unclear how to do that with a non-unicodeText field, the next 
step seems a bit problematic,
and, quite frankly, churning through 'ZaX',ZbX', 'ZcX', etc. (and I'm 
working with an abugida that features
about 4000 glyphs . . . joy) seems tedious in the extreme.

I thought about churning through a list of unicode addresses like this;

on mouseUp
put 2200 into CLICKER
repeat until CLICKER = 50000
     set the useUnicode to true
     if the unicodeText of fld "FIRST" contains (numToChar(57888) & 
numToChar(CLICKER) & numToChar(57999)) then
        get the unicodeText of fld "FIRST"
        replace (numToChar(57888) & numToChar(CLICKER) & 
numToChar(57999))) with
       (numToChar(105) & numToChar(CLICKER) & numToChar(105)) in it
        set the unicodeText of fld "FIRST" to it
     end if
add 1 to CLICKER
end mouseUp

and, theoretically, it works.

the only thing that slightly fusses me about that is what happens if a 
unicode address is empty and/or I land
up against a control character?




More information about the use-livecode mailing list