Wildcard expressions and unicode ???
Richmond Mathewson
richmondmathewson at gmail.com
Tue Apr 6 12:27:46 EDT 2010
On 06/04/2010 14:57, Peter Brigham MD wrote:
> Try this? Untested but should work. (The untested part is the first
> handler -- the offsets() function I have been using for years.)
>
> on mouseup
> set the useUnicode to true
> put numtochar(57888) into targetChar
> put the unicodetext of fld "FIRST" into uText
> put offsets(targetChar,uText) into offsetList
> if offsetList = 0 then exit mouseup
> repeat for each item i in offsetList
> put char i+1 of uText & targetChar into \
> char i to i+1 of uText
> end repeat
> set the unicodetext of fld "FIRST" to uText
> end mouseup
>
> function offsets str,cntr
> -- returns a comma-delimited list
> -- of all the offsets of str in cntr
> if str is not in cntr then return 0
> put "" into offsetList
> put 0 into startPoint
> repeat
> put offset(str,cntr,startPoint) into thisOffset
> if thisOffset = 0 then exit repeat
> add thisOffset to startPoint
> put startPoint & comma after offsetList
> end repeat
> delete last char of offsetList
> return offsetList
> end offsets
>
Unfortunately does not work, but
in my fld "FIRST", which initially contains 4 unicode chars, outputs 2
unicode chars.
Probably something to do with the fact that those are 4 double-byte chars.
This is where "Keeps Death his court and there the antic sits"; the
antic being the problem
with double-byte characters:
"Scoffing his state and grinning at his pomp,
Allowing him a breath, a little scene,
To monarchize, be fear'd and kill with looks,"
and mysen fair forjeskit . . . :( an blackafrontit tae! whit a scunner.
I was monarchizin a bit, so pleased with my unicode "exchange" script, but
the antic (as usual) scoffed most effectively at my self-assumed pomp.
More information about the use-livecode
mailing list