Library
Module
Module type
Parameter
Class
Class type
Fold over the characters of UTF encoded OCaml string
values.
encoding_guess s
is the encoding guessed for s
coupled with true
iff there's an initial BOM.
Note. Initial BOMs are also folded over.
type 'a folder = 'a -> int -> [ `Uchar of uchar | `Malformed of string ] -> 'a
The type for character folders. The integer is the index in the string where the `Uchar
or `Malformed
starts.
val fold_utf_8 : 'a folder -> 'a -> string -> 'a
fold_utf_8 f a s
is f (
... (f (f a 0 u
0) j
1 u
1)
... )
... )
j
n u
n where u
i, j
i are the Unicode scalar value and the starting position of the characters in the UTF-8 encoded string s
.
val fold_utf_16be : 'a folder -> 'a -> string -> 'a
fold_utf_16be f a s
is f (
... (f (f a 0 u
0) j
1 u
1)
... )
... )
j
n u
n where u
i, j
i are the Unicode scalar value and the starting position of the characters in the UTF-16BE encoded string s
.
val fold_utf_16le : 'a folder -> 'a -> string -> 'a
fold_utf_16le f a s
is f (
... (f (f a 0 u
0) j
1 u
1)
... )
... )
j
n u
n where u
i, j
i are the Unicode scalar value and the starting position of the characters in the UTF-16LE encoded string s
.