Find some text characters

Thierry Douez th.douez at gmail.com
Mon Jul 17 23:54:27 EDT 2017


2017-07-18 3:53 GMT+02:00 Thierry Douez <th.douez at gmail.com>:

>
>> I want to know if this data contains Chinese characters
>>
>> Thanks for suggestions!
>>
>> Peter Bogdanoff
>>
>>
> ​Hi Peter,
>


​Ok, back after my second morning coffee :)

A better way to check for Chinese code points would be
something like that (not tested and never used myself) :


function testForChinese utf8Text
   return matchText( utf8Text, "\p{Han}")
end testForChinese

Of course, it won't work with  htmlText, but straight with
the text of a field, assuming it's coded in UTF8 !!!


HTH,

Thierry
​

>> ​Mmm, not sure you'll get *only* Chinese characters,
> but at least any entity with only 5 numbers.
>
> This function returns true if find any, false otherwise:
>> function testForChinese T
> ​xt​
> ​ -- any htmltext​
>    return matchText(
> ​Txt
> , "&#\d{5};")
> end testForChinese
>
> ​Regards,
>
> Thierry​
>


-- 
------------------------------------------------
Thierry Douez - sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage



More information about the use-livecode mailing list