module StrExtras: sig end
String construction
|
val combine : string list -> string
val map : (char -> char) -> string -> string
Array.map
, for strings. Returns a newly allocated transformed string.
String manipulation
|
val first_word : string -> string
val cut_first_char : string -> string
val cut_first_n : string -> int -> string
n
characters of a string and returns the rest.val cut_last_char : string -> string
val cut_last_n : string -> int -> string
n
characters of a string and returns the restval cut_first_word : string -> string
val split_at : str:string -> sep:char -> string
val chomp : string -> string
val map_inplace : (char -> char) -> string -> unit
map
, but modifies the argument string.
Capitalization
|
val uppercase : string -> string
String.uppercase
, but locale-dependantval lowercase : string -> string
String.lowercase
, but locale-dependantval capitalize : string -> string
String.capitalize
, but locale-dependantval uncapitalize : string -> string
String.uncapitalize
, but locale-dependant
String searching
|
val first_of : string -> string -> int
first_of needle haystack
returns the position of the first occurance in haystack of a character in needle. Like C strcspn().Not_found
if no characters in needle are in haystackval first_of_from : string -> string -> int -> int
first_of_from needle haystack pos
returns the position of the first occurance in haystack (Starting at pos) of a character in needle.Not_found
if no characters in needle are in haystackval first_not_of : string -> string -> int
first_not_of needle haystack
returns the position of the first occurance in haystack of a character that's not also in needle. Like C strspn().Not_found
if all characters in needle are in haystackval first_not_of_from : string -> string -> int -> int
first_not_of_from needle haystack pos
returns the position of the first occurance in haystack (Starting at pos) of a character that's not also in needle.Not_found
if all characters in needle are in haystackval prefix : string -> string -> bool
prefix pref str
returns true if str starts with pref.val suffix : string -> string -> bool
suffix suf str
returns true if str starts with suf.val index_substr : string -> string -> int
index_str needle haystack
returns the position in haystack where needle starts.Not_found
if the substring isn't present.val index_substr_from : string -> string -> int -> int
index_substr_from needle haystack pos
returns the position in haystack where needle starts, starting looking at pos.Not_found
if the substring isn't present.Invalid_argument
if the positition is outside of haystack.val match_substr : string -> string -> int -> bool
match_substr substr str pos
returns true if str contains substr at position posInvalid_argument
if pos is out of range