fraser.gordon at runrev.com
Fri Apr 4 21:02:04 CEST 2014
On 04/04/2014 18:47, Richmond wrote:
>> So, checking out "codepointProperty" in the Dictionary [AND, I am
>> very happy to say, the
>> Dictionary seems more up-to-date than it has been for years] I read
>> "This function is not intended for general-purpose use; please use
>> functions such as toUpper or
>> the is operators instead."
>> Apart from the fact that a bit of bold text might not have been a bad
>> idea both for 'toUpper' and
>> even more for 'is'; I wonder why 'codepointProperty' is not for
>> general-purpose use (it is stated without
>> any explanation) as it looks an extremely useful tool . . .
That note was really just to encourage people to look elsewhere in case
they stumble across the entry when searching for "uppercase" or similar.
Trying to uppercase a string using codepointProperty is likely to be
significantly slower than using the built-in functions. For persons like
yourself, however, feel free to ignore the warning - I think it is fair
to say that your use is not "general purpose".
> "numToChar" produced ASCII chars.
> Does this mean that "numToChar" has gone west?
NumToChar only returns ASCII characters (by interpreting the number
given as modulo 256 - backwards compatibility strikes again). For
Unicode codepoints, you should instead use numToCodepoint.
It is worth noting that codepointProperty only accepts single
codepoints, i.e you shouldn't put quotation marks or similar around the
codepoint. Basically, the expression passed to the function should
either be the output of numToCodepoint or an expression of the form
"codepoint x of ..." - as you saw, it will get snooty if you pass a
string to it (though a string of length 1, which is what a codepoint is
really, also works).
More information about the use-livecode