Return a copy of the argument, with all lowercase letters translated to uppercase, including accented letters of the ISO Latin-1 (8859-1) character set.
deprecated
Functions operating on Latin-1 character set are deprecated.
val lowercase : string -> string
Return a copy of the argument, with all uppercase letters translated to lowercase, including accented letters of the ISO Latin-1 (8859-1) character set.
deprecated
Functions operating on Latin-1 character set are deprecated.
val capitalize : string -> string
Return a copy of the argument, with the first character set to uppercase, using the ISO Latin-1 (8859-1) character set..
deprecated
Functions operating on Latin-1 character set are deprecated.
val uncapitalize : string -> string
Return a copy of the argument, with the first character set to lowercase, using the ISO Latin-1 (8859-1) character set.
deprecated
Functions operating on Latin-1 character set are deprecated.
Binary decoding of integers
The functions in this section binary decode integers from strings.
All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.
Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.
32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.
8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.
val get_uint8 : string ->int -> int
get_uint8 b i is b's unsigned 8-bit integer starting at character index i.
since 4.13.0
val get_int8 : string ->int -> int
get_int8 b i is b's signed 8-bit integer starting at character index i.
since 4.13.0
val get_uint16_ne : string ->int -> int
get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.
since 4.13.0
val get_uint16_be : string ->int -> int
get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.
since 4.13.0
val get_uint16_le : string ->int -> int
get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.
since 4.13.0
val get_int16_ne : string ->int -> int
get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.
since 4.13.0
val get_int16_be : string ->int -> int
get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.
since 4.13.0
val get_int16_le : string ->int -> int
get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.
since 4.13.0
val get_int32_ne : string ->int -> int32
get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.
since 4.13.0
val get_int32_be : string ->int -> int32
get_int32_be b i is b's big-endian 32-bit integer starting at character index i.
since 4.13.0
val get_int32_le : string ->int -> int32
get_int32_le b i is b's little-endian 32-bit integer starting at character index i.
since 4.13.0
val get_int64_ne : string ->int -> int64
get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.
since 4.13.0
val get_int64_be : string ->int -> int64
get_int64_be b i is b's big-endian 64-bit integer starting at character index i.
since 4.13.0
val get_int64_le : string ->int -> int64
get_int64_le b i is b's little-endian 64-bit integer starting at character index i.
since 4.13.0
val equal : string ->string -> bool
Equality function on strings.
val compare : string ->string -> int
val is_empty : string -> bool
is_empty s returns true iff s is empty (i.e. its length is 0).
since 1.5
val hash : string -> int
val init : int ->(int -> char)-> string
Like Array.init.
since 0.3.3
val rev : string -> string
rev s returns the reverse of s.
since 0.17
val pad : ?side:[ `Left | `Right ]->?c:char ->int ->string -> string
pad n str ensures that str is at least n bytes long, and pads it on the side with c if it's not the case.
val filter_map : (char ->char option)->string -> string
filter_map f s calls (f a0) (f a1) ... (f an) where a0 ... an are the characters of s. It returns the string of characters ci such as f ai = Some ci (when f returns None, the corresponding element of s is discarded).
since 0.17
val filter : (char -> bool)->string -> string
filter f s discards characters not satisfying f.
since 0.17
val flat_map : ?sep:string ->(char -> string)->string -> string
Map each chars to a string, then concatenates them all.
compare_versions a b compares version strings a and b, considering that numbers are above text.
since 0.13
val compare_natural : string ->string -> int
Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order
since 1.3
val edit_distance : string ->string -> int
Edition distance between two strings. This satisfies the classical distance axioms: it is always positive, symmetric, and satisfies the formula distance a b + distance b c >= distance a c.