package camomile
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=41e02d124c3fa29ea511110d2c6532de
sha512=b0ae3d921f65390e8ec88a04901dd097b568db9f9ae70fb328e9d3ddb2dd8922b9a8e8da9ace91ad9cb5f6a1310ae5b6ba502e287d6c828f4d60622289316ac8
doc/camomile.lib/CamomileLib/UTF16/index.html
Module CamomileLib.UTF16
type t =
(int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.tUTF-16 encoded string. the type is the bigarray of 16-bit integers. The characters must be 21-bits code points, and not surrogate points, 0xfffe, 0xffff. Bigarray.cma or Bigarray.cmxa must be linked when this module is used.
val validate : t -> unitvalidate s If s is valid UTF-16 then successes otherwise raises Malformed_code. Other functions assume strings are valid UTF-16, so it is prudent to test their validity for strings from untrusted origins.
All functions below assume strings are valid UTF-16. If not, the result is unspecified.
get s n returns n-th Unicode character of s. The call requires O(n)-time.
init len f returns a new string which contains len Unicode characters. The i-th Unicode character is initialized by f i if the character is not representable, raise Out_of_range.
val length : t -> intlength s returns the number of Unicode characters contained in s
Positions in the string represented by the number of 16-bit unit from the head. The location of the first character is 0
nth s n returns the position of the n-th Unicode character. The call requires O(n)-time
look s i returns the Unicode character of the location i in the string s.
compare_aux s i1 i2 returns
- If
i1is the position located beforei2, a value < 0, - If
i1andi2points the same location, 0, - If
i1is the position located afteri2, a value > 0.
next s i returns the position of the head of the Unicode character located immediately after i.
- If
iis a valid position, the function always success. - If
iis a valid position and there is no Unicode character afteri, the position outsidesis returned. - If
iis not a valid position, the behaviour is undefined.
prev s i returns the position of the head of the Unicode character located immediately before i.
- If
iis a valid position, the function always success. - If
iis a valid position and there is no Unicode character beforei, the position outsidesis returned. - If
iis not a valid position, the behaviour is undefined.
iter f s Apply f to all Unicode characters in s. The order of application is same to the order in the Unicode characters in s.
module Buf : sig ... endBuffer module for UTF-16