Stk.Utf8
Handling UTF-8 strings.
rev_chars str ~pos ~len
returns the list, in reverse order, of characters in str
from pos
to pos+len
. If pos
or len
is invalid, an error message is logged but the function returns what it could find. Optional argument acc
can be provided as initial accumulator.
sub str ~pos ~len
returns substring of str
from pos
to pos+len
. If pos
or len
is invalid, an error message is logged but t he function returns what it could find.
blit str pos target pos_target len
copies len
characters from str
beginning at position pos
to target
beginning at position pos_target
. Returns the number of copied characters.
cut str ~pos ~len
returns three strings, corresponding to contents of str
before pos, contents of str
between pos
and pos+len
, and contents of str
after pos+len
. Raises Invalid_argument
if pos < 0
.
to_chunks max_len str
cuts str
in chunks of max_len
characters maximum.
insert str ~pos str2
returns a new string where str2
was inserted in str
at position pos
.
normalize str
performs a `NFC
normalization to return a new string. See Uunf_string
.normalize_utf_8.
string_of_uchar c
returns the string corresponding to given Utf68 character c
.