[luatex] problem with slnunicode's find

Patrick Gundlach patrick at gundla.ch
Tue Mar 2 07:46:40 CET 2010


Hi Stephan,

> 
>> --	NOTE: find positions are in bytes for all ctypes!
> > --	use ascii.sub to cut found ranges!
> 
> Hmm, neither do I want to cut something nor do I have a range available.  I just want to count.  Attached is my attempt of a utf8 aware find function based on the utf8 aware parts of slnunicode.  Comments and improvements are welcome!

What is wrong with

str="äöABCäö"

b,e = unicode.utf8.find(str,"%u+")
print(string.sub(str,b,e))
print("count=" .. tostring(e - b + 1))

?

Patrick




More information about the luatex mailing list