package bigstring
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=cee68d33b2644b8b98f98d4fd30d7e3915ed4ba639d35f42a7d75f64aa68f306
md5=5582e995b7d4c9e4a2949214756db7dd
doc/bigstring/Bigstring/index.html
Module BigstringSource
Interface to 1-dimension Bigarrays of bytes (char)
A "bigstring" here is simply a bigarray of chars. It can be used instead of regular strings when IO involve calling C (or another language), when very large strings are required, or for memory-mapping.
Initialize with the given function (called at every index). init n f is the string f 0, f 1, ..., f (n-1).
fill_slice s c i len is the same as fill (sub s i len) c, it fills the slice from i to i+len-1 of s with the char c
Same as get, but without bound check. Can fail arbitrarily (including segfault) if used improperly.
Same as set, but without bound check. Can fail arbitrarily (including segfault) if used improperly.
Blit a slice of the bigstring into another. blit s1 i1 s2 i2 len means that elements from s1 whose indices range from i1 to i1+len-1 are copied into the slots of s2 whose indices range from i2 to i2+len-1. This is similar to String.blit or Bytes.blit or Array.blit.
sub s i len takes a slice of length len from the string s, starting at offset i. The slice shares the same memory as s, meaning that modifications of the slice will modify s as well. Slicing is cheap since it does not involve copying the whole range.
Conversions
Utils
concat set l concatenates the list l, inserting sep between each pair of string.
Copy of the string with all characters in lowercase (see Char.lowercase)
Copy of the string with all characters in uppercase (see Char.uppercase)
trim s returns a slice of s without the leading and trailing whitespaces, where whitespaces are defined identically to String.trim. note that it does not copy the substring, but returns a slice!
index s ~c returns the index of the first occurrence of character c in string s.
rindex s ~c returns the index of the last occurrence of character c in string s.
index_pred ~f s returns the index of the first char in s that satisfies s.
rindex_pred ~f s returns the index of the last char in s that satisfies s.
String.contains s c tests if character c appears in the string s.