Unicode strings: Difference between revisions

Content deleted Content added
PureFox (talk | contribs)
m →‎{{header|Wren}}: Changed to Wren S/H
Langurmonkey (talk | contribs)
Line 827: Line 827:
<syntaxhighlight lang="langur">q:any"any code points here"</syntaxhighlight>
<syntaxhighlight lang="langur">q:any"any code points here"</syntaxhighlight>


Indexing on a string indexes by code point. The index may be a single number, a range, or an array of such things.
Indexing on a string indexes by code point. The index may be a single number, a range, or an list of such things.


Conversion between code point numbers and strings can be done with the cp2s() and s2cp() functions. The s2cp() function accepts a single index number or range, returning a single code point number or an array of them. The s2s() function returns a string instead (while allowing you to index by code points). The cp2s() function accepts a single code point or an array and returns a string.
Conversion between code point numbers, graphemes, and strings can be done with the cp2s(), s2cp(), and s2gc() functions. Conversion between UTF-8 byte lists and langur strings can be done with b2s() and s2b() functions.

Conversion between UTF-8 byte arrays and langur strings can be done with b2s() and s2b() functions.


The len() function returns the number of code points in a string.
The len() function returns the number of code points in a string.