package batteries

  1. Overview
  2. Docs
A community-maintained standard library extension

Install

Dune Dependency

Authors

Maintainers

Sources

v3.9.0.tar.gz
md5=ea26b5c72e6731e59d856626049cca4d
sha512=55975b62c26f6db77433a3ac31f97af609fc6789bb62ac38b267249c78fd44ff37fe81901f1cf560857b9493a6046dd37b0d1c0234c66bd59e52843aac3ce6cb

doc/batteries.unthreaded/BatString/Exceptionless/index.html

Module BatString.ExceptionlessSource

Exceptionless counterparts for error-raising operations

Sourceval to_int : string -> int option

Returns the integer represented by the given string or None if the string does not represent an integer.

Sourceval to_float : string -> float option

Returns the float represented by the given string or None if the string does not represent a float.

Sourceval index : string -> char -> int option

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.

Sourceval rindex : string -> char -> int option

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.

Sourceval index_from : string -> int -> char -> int option

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.

Sourceval rindex_from : string -> int -> char -> int option

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.

Sourceval find : string -> string -> int option

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.

Sourceval find_from : string -> int -> string -> int option

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.

Sourceval rfind : string -> string -> int option

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.

Sourceval rfind_from : string -> int -> string -> int option

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.

Sourceval split : string -> by:string -> (string * string) option

split s sep splits the string s between the first occurrence of sep, or returns None if the separator is not found.

Sourceval rsplit : string -> by:string -> (string * string) option

rsplit s sep splits the string s between the last occurrence of sep, or returns None if the separator is not found.

OCaml

Innovation. Community. Security.