Title: Theory / Unimportant / CS / Programming / oCaml / Library / Str;
Tags: computer_to_instruction hasNotNewEffectReturnsMeaning fromCommandLine FromInstruction syntactical_sugar type
On every note of this deck, unless a note says otherwise:
Page: https://caml.inria.fr/pub/docs/manual-ocaml/libref/Str.html
Language: ocaml

Typ: regexp
Meaning: The type of compiled regular expressions.
Page: https://caml.inria.fr/pub/docs/manual-ocaml/libref/Str.html
Language: ocaml

Instruction: regexp
Effect: Compile a regular expression.
Typ: string -> regexp

Instruction: regexp_case_fold
Effect: Compile a regular expression, ignoring the case

Instruction: quote
Effect: A regexp matching the argument, and only that
Typ: string -> string

Instruction: regexp_string
Returns: A regular expression that matches exactly s and nothing else.
Typ: string -> regexp

Instruction: regexp_string_case_fold
Returns: A regular expression that matches exactly s and nothing else. Ignoring case
Typ: string -> regexp

Instruction: string_partial_match foo bar buz
Returns: Whether a substring of bar, at position [buz,x], for some x matches the regexp foo

Instruction: string_match foo bar buz
Returns: Whether a substring of bar, at position [buz,end] matches the regexp foo

Instruction: search_forward foo bar buz
Effect: Least position, at least at buz, where the substring of letters [bar, end]matches the regexp foo

Instruction: search_forward foo bar buz
Effect: greatest position, at most at buz, where the substring of letters [bar, end]matches the regexp foo
Extra: instruction duplicated. one is wrong

Instruction: matched_string foo
Effect: The substring of foo matched by the last call to a Str search/replace function

Instruction: matched_beginning ()
Effect: the position of the first character
of the substring that was matched by the last call to a matching
or searching function

Instruction: matched_end ()
Effect: the position of the character following the substring that was matched by the last call to a matching
or searching function

Instruction: matched_group foo bar
Effect: the substring of bar that was matched by the footh group \ (...\ ) of the regular expression that was matched by the last call to a matching or searching function

Instruction: group_beginning foo
Effect: the position of the first character of the substring that was matched by the footh group of the regular expression that was matched by the last call to a matching or searching function

Instruction: group_end foo
Effect: the position after the last character of the substring that was matched by the footh group of the regular expression that was matched by the last call to a matching or searching function

Instruction: substitute_first foo buz bar
Effect: a string, identical to bar except that the first substring of bar that match the regexp foo have been replaced by the result of buz applied to this substring

Instruction: global_replace foo buz bar
Effect: a string, identical to bar except that all substrings of bar that match the regexp foo have been replaced by buz

Instruction: global_substitute foo buz bar
Effect: a string, identical to bar except that all substrings of bar that match the regexp foo have been replaced by the result of buz applied to this substring

Instruction: replace_first foo buz bar
Effect: a string, identical to bar except that the first substring of bar that match the regexp foo have been replaced by buz

Instruction: replace_matched foo buz
Effect: the replacement text foo in which \i has been replaced by the text matched by the corresponding group in the regular expression that was matched by the last call to a matching or searching function.
buz must be the same string

Instruction: split reg str
Effect: The string str splitted at elements matching the regexp reg

Instruction: bounded_split foo bar buz
Effect: The string bar splitted at most buz-1 time at position matching the regexp foo

Instruction: split_delim foo bar
Effect: Similar to split, but with empty strim beginning/ending the list if the delimiter begin/end the string

Instruction: bounded_split_delim foo bar
Effect: Similar to bounded_split, but with empty strim beginning/ending the list if the delimiter begin/end the string

Instruction: full_split_delim foo bar
Returns: Similar to split_delim, but returns both strings and delimiters, in a list

Instruction: bounded_full_split_delim foo bar buz
Effect: Similar to bounded_split_delim, but returns both strings and delimiters, in a list

Instruction: string_before foo bar
Effect: the substring of all characters of foo that precede position bar

Instruction: string_after foo bar
Effect: the substring of all characters of foo beginning at position bar