Advanced

Change History

Discuss your script development with others (bugs, optimizations, methods ...)

Message: Re: Any UTF-8 support?

Changed By: jpavlik
Change Date: November 12, 2018 01:37PM

Re: Any UTF-8 support?
currently a few function for utf8 strings are available:

PGC.UTF8SubStr(string,start,length )
start is counted from 1, currently there is a bug for negative start (counting from the end of string)
if length is not specified, entire rest of string is returned

PGC.UTF8ToLower(string)
PGC.UTF8ToUpper(string)

currently there is no function for count the number of characters of the utf8 string, however you can easely define it.

[code]
function UTF8Len(str)
return str:gsub("[\128-\191]", """" ):len()
end
[/code]

added later:
now there is official PGC function
PGC.UTF8Len(string)

Original Message

Author: jpavlik
Date: August 20, 2018 11:20AM

Re: Any UTF-8 support?
currently a few function for utf8 strings are available:

PGC.UTF8SubStr(string,start,length )
start is counted from 1, currently there is a bug for negative start (counting from the end of string)
if length is not specified, entire rest of string is returned

PGC.UTF8ToLower(string)
PGC.UTF8ToUpper(string)

currently there is no function for count the number of characters of the utf8 string, however you can easely define it.

function UTF8Len(str)
return str:gsub("[\128-\191]", ""):len()
end