module UTF8Impl:sig
..end
One is advised to use the Utils.UTF8
module instead of this one.
type
t
type
modified
typebytes =
string
string
,
used to underline its use as an array of bytes.type
error =
| |
Unable_to_convert_to_modified_utf8 of |
| |
Unable_to_convert_from_modified_utf8 of |
| |
Unable_to_convert_to_utf8 of |
| |
Unable_to_convert_from_utf8 of |
| |
Invalid_index of |
| |
Index_out_of_bounds of |
| |
Invalid_escaped_string of |
exception Exception of error
val string_of_error : error -> string
val make : UCharImpl.t list -> t
val modified_of_bytes : bytes -> modified
val bytes_of_modified : modified -> bytes
val to_modified : t -> modified
Exception
if conversion fails.val of_modified : modified -> t
Exception
if conversion fails.val to_string : t -> string
Exception
if conversion fails.val to_string_noerr : t -> string
to_string
, except that any exception is discarded and
"..."
is returned.val of_string : string -> t
Exception
if conversion fails.val to_bytes : t -> bytes
Exception
if conversion fails.val of_bytes : bytes -> t
Exception
if conversion fails.val of_char : char -> t
Exception
if conversion fails.val of_uchar : UCharImpl.t -> t
val length : t -> int
val get : t -> int -> UCharImpl.t
get s i
returns the character of s
at index i
.
Raises Exception
if index is not valid.val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val index_from : t -> int -> UCharImpl.t -> int
index_from s i c
returns the lowest index above or equal to i
where string s
contains a character that equals c
.
Raises Not_found
if such an index does not exist.val rindex_from : t -> int -> UCharImpl.t -> int
rindex_from s i c
returns the highest index below or equal to i
where string s
contains a character that equals c
.
Raises Not_found
if such an index does not exist.val substring : t -> int -> int -> t
substring s start end
returns a string whose characters are those
of s
from index first
to index last
(both inclusive).
Returns an empty string iff last < first
.
Raises Exception
if first
or last
is not a valid index.val (++) : t -> t -> t
val concat : t list -> t
concat l
returns the concatenation of all strings in l
.val concat_sep : t -> t list -> t
concat_sep sep l
returns the concatenation of all strings in l
,
separator sep
being inserted between two strings.val concat_sep_map : t -> ('a -> t) -> 'a list -> t
concat_sep_map sep f l
returns the concatenation of all strings in
l'
, separator sep
being inserted between two strings.
l'
is defined as List.map f l
.val replace : UCharImpl.t -> UCharImpl.t -> t -> t
replace c1 c2 s
returns a copy of s
where every character equal
to c1
has been replaced by c2
.val contains : UCharImpl.t -> t -> bool
contains c s
returns true
iff string s
contains a character
equal to c
.val split : UCharImpl.t -> t -> t list
split c s
returns the string list obtained by splitting s
using
delimiter c
.val trim : t -> t
trim s
returns the passed string with neither leading nor trailing
spaces.val escape : t -> t
escape s
returns the literal constant string corresponding to the
passed string. A leading and a trailing double quote are added and
every quote inside the passed string is escaped by a backslash.val unescape : t -> t
unescape s
returns the string corresponding to the passed literal
constant string. Both leading and trailing quotes are removed and
escaped sequences are converted.val escape_char : UCharImpl.t -> t
escape_char c
returns the literal constant string corresponding to
the passed character. A leading and a trailing simple quote are added.