aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
Diffstat (limited to 'manual')
-rw-r--r--manual/manual.of22
1 files changed, 14 insertions, 8 deletions
diff --git a/manual/manual.of b/manual/manual.of
index f830b01c..359bd166 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -7958,21 +7958,27 @@ returns @fail plus the position of the first invalid byte.
7958 7958
7959@LibEntry{utf8.offset (s, n [, i])| 7959@LibEntry{utf8.offset (s, n [, i])|
7960 7960
7961Returns the position (in bytes) where the encoding of the 7961Returns the the position of the @id{n}-th character of @id{s}
7962@id{n}-th character of @id{s} 7962(counting from byte position @id{i}) as two integers:
7963(counting from position @id{i}) starts. 7963The index (in bytes) where its encoding starts and the
7964index (in bytes) where it ends.
7965
7966If the specified character is right after the end of @id{s},
7967the function behaves as if there was a @Char{\0} there.
7968If the specified character is neither in the subject
7969nor right after its end,
7970the function returns @fail.
7971
7964A negative @id{n} gets characters before position @id{i}. 7972A negative @id{n} gets characters before position @id{i}.
7965The default for @id{i} is 1 when @id{n} is non-negative 7973The default for @id{i} is 1 when @id{n} is non-negative
7966and @T{#s + 1} otherwise, 7974and @T{#s + 1} otherwise,
7967so that @T{utf8.offset(s, -n)} gets the offset of the 7975so that @T{utf8.offset(s, -n)} gets the offset of the
7968@id{n}-th character from the end of the string. 7976@id{n}-th character from the end of the string.
7969If the specified character is neither in the subject
7970nor right after its end,
7971the function returns @fail.
7972 7977
7973As a special case, 7978As a special case,
7974when @id{n} is 0 the function returns the start of the encoding 7979when @id{n} is 0 the function returns the start and end
7975of the character that contains the @id{i}-th byte of @id{s}. 7980of the encoding of the character that contains the
7981@id{i}-th byte of @id{s}.
7976 7982
7977This function assumes that @id{s} is a valid UTF-8 string. 7983This function assumes that @id{s} is a valid UTF-8 string.
7978 7984