codePointToNum

Richmond richmondmathewson at gmail.com
Fri Mar 31 09:36:26 EDT 2017


Thanks for a very prompt and useful reply!

Richmond.

On 31/03/17 13:33, Mark Waddingham via use-livecode wrote:
> On 2017-03-31 12:12, Richmond via use-livecode wrote:
>> So, if I do something like this:
>>
>> *put the codePointToNum("§")*
>>
>> I will get the Unicode address of that character as a Decimal number.
>>
>> How can I get it as a Hex number?
>
> Two options - you can use baseConvert:
>
>   put baseConvert(10, 16, codepointToNum("§")
>
> or you can use format:
>
>   put format("%x", codepointToNum("§"))
>
> The latter is much more flexible e.g.:
>
>   put format("\\u{%06x}", codepointToNum("§"))
>
> Gives the codepoint as the escape sequence for JSON strings (for 
> example).
>
> Warmest Regards,
>
> Mark.
>





More information about the use-livecode mailing list