Denys Duchier
This module provides additional convenience operation on strings.
It should not be confused, with the base String
which is
always present and does not need to be imported.
{String.make +VS ?S}
{String.length +S ?N}
N
of string S
{String.toInt +S ?I}
S
and returns the integer I
of
which it is the textual representation
{String.toFloat +S ?F}
S
and returns the float F
of
which it is the textual representation
{String.toInt +S ?A}
S
and returns the corresponding
atom A
{String.capitalize +S1 ?S2}
S1
and returns a string S2
which is identical except for the first letter which has been capitalized
{String.split +S +Sep ?L}
S
at all occurrences of string Sep
and returns the resulting list L
. Sep
may also be
unit
in which case splits occur at all non-empty sequences of
whitespace characters. It can also be nil
, in which case
splits occur between every two characters
{String.splitAtMost +S +Sep +N ?L}
N
splits are performed: the
remainder of the string is returned as the last element of list L
{String.lstrip +S1 +Chars ?S2}
S1
and returns a string
S2
where all characters at the left of S1
which are in Chars
have been removed. Chars
can also be unit
, in which case it stands for all whitespace
characters
{String.rstrip +S1 +Chars ?S2}
S1
{String.strip +S1 +Chars ?S2}
{String.replace +S1 +Old +New ?S2}
Old
in S1
by New
{String.replaceAtMost +S1 +Old +New +N ?S2}
N
occurrences of
Old