grapheme_substrReturn part of a string
&reftitle.description;
&style.procedural;stringfalsegrapheme_substrstringstringintoffsetintnulllength&null;
Return part of a string
&reftitle.parameters;
string
The input string. Must be valid UTF-8.
offset
Start position in default grapheme units.
If offset is non-negative, the returned string will start at the
offset'th position in string, counting from zero. If offset is negative,
the returned string will start at the offset'th grapheme unit from the
end of string.
length
Length in grapheme units.
If length is given and is positive, the string returned will contain
at most length grapheme units beginning from offset (depending on the
length of string). If length is given and is negative, then
that many grapheme units will be omitted from the end of string (after the
start position has been calculated when offset is negative). If offset
denotes a position beyond this truncation, an empty string will be returned.
&reftitle.returnvalues;
Returns the extracted part of string, &return.falseforfailure;.
&reftitle.changelog;
&Version;&Description;8.0.0
The function now consistently clamps out-of-bounds offsets to the string boundary.
Previously, &false; was returned instead of the empty string in some cases.
&reftitle.examples;
grapheme_substr example
]]>
&example.outputs;
&reftitle.seealso;
grapheme_extract
Unicode Text Segmentation: Grapheme Cluster Boundaries