package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=1bcb27dfbd130eb057561196ef851649
sha512=2a56611b09a5f1cba6457539f8b6bc87a5f2a5454b36cdb39f6e0d6a5dac6db179aab1ba87c74dd49cc41df31a9a96feb349028ea41df7371ecb47f4d9dfafc4
doc/batteries.unthreaded/BatString/Exceptionless/index.html
Module BatString.Exceptionless
Exceptionless counterparts for error-raising operations
Returns the integer represented by the given string or None
if the string does not represent an integer.
Returns the float represented by the given string or None
if the string does not represent a float.
index s c
returns Some p
, the position of the leftmost occurrence of character c
in string s
or None
if c
does not occur in s
.
rindex s c
returns Some p
, the position of the rightmost occurrence of character c
in string s
or None
if c
does not occur in s
.
Same as String.Exceptionless.index
, but start searching at the character position given as second argument. index s c
is equivalent to index_from s 0 c
.
Same as String.Exceptionless.rindex
, but start searching at the character position given as second argument. rindex s c
is equivalent to rindex_from s (String.length s - 1) c
.
find s x
returns Some i
, the starting index of the first occurrence of string x
within string s
, or None
if x
is not a substring of s
.
Note This implementation is optimized for short strings.
find_from s ofs x
behaves as find s x
but starts searching at offset ofs
. find s x
is equivalent to find_from s 0 x
.
rfind s x
returns Some i
, the starting index of the last occurrence of string x
within string s
, or None
if x
is not a substring of s
.
Note This implementation is optimized for short strings.
rfind_from s ofs x
behaves as rfind s x
but starts searching at offset ofs
. rfind s x
is equivalent to rfind_from s (String.length s - 1) x
.
split s sep
splits the string s
between the first occurrence of sep
, or returns None
if the separator is not found.