546
edits
m (sort alphabetic) |
(add UTF8 functions from former plausible.org) |
||
Line 178: | Line 178: | ||
Output: http://otile1.mqcdn.com/tiles/1.0.0/map/3/5/4.jpg | Output: http://otile1.mqcdn.com/tiles/1.0.0/map/3/5/4.jpg | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== UTF8 String Functions (Core) == | |||
=== utf8.chstr(unicode) === | |||
Returns a string containing the UTF8 representation of the specified unicode character value. | |||
=== utf8.strc(string, index) === | |||
Returns the unicode character at the specified index within the UTF8 string. Dies on encoding error or overrun. | |||
=== utf8.substr(string, start, len=nil) === | |||
As for regular substr(), but the indices are of UTF8 characters intead of bytes. Dies on encoding error or overflow. | |||
=== utf8.size(string) === | |||
As for regular size() when called on a string, but returns the number of UTF8 unicode characters instead of bytes. Dies on encoding error. | |||
=== utf8.validate(string, replace=`?`) === | |||
Checks the string for UTF8 validity. At every byte position where an encoding error is found, it replaces that byte with the specified replacement character (default is `?`). Note that the second argument is a number, not a string. |
edits