module StrExtras: sig end
String construction
|
val combine : string list -> stringval map : (char -> char) -> string -> stringArray.map, for strings. Returns a newly allocated transformed string.
String manipulation
|
val first_word : string -> stringval cut_first_char : string -> stringval cut_first_n : string -> int -> stringn characters of a string and returns the rest.val cut_last_char : string -> stringval cut_last_n : string -> int -> stringn characters of a string and returns the restval cut_first_word : string -> stringval split_at : str:string -> sep:char -> stringval chomp : string -> stringval map_inplace : (char -> char) -> string -> unitmap, but modifies the argument string.
Capitalization
|
val uppercase : string -> stringString.uppercase, but locale-dependantval lowercase : string -> stringString.lowercase, but locale-dependantval capitalize : string -> stringString.capitalize, but locale-dependantval uncapitalize : string -> stringString.uncapitalize, but locale-dependant
String searching
|
val first_of : string -> string -> intfirst_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 -> intfirst_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 -> intfirst_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 -> intfirst_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 -> boolprefix pref str returns true if str starts with pref.val suffix : string -> string -> boolsuffix suf str returns true if str starts with suf.val index_substr : string -> string -> intindex_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 -> intindex_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 -> boolmatch_substr substr str pos returns true if str contains substr at position posInvalid_argument if pos is out of range