std/core/string▲toc

Standard stringstd/core/types/string: V functions.

.

fun char/string( c : charstd/core/types/char: V ) : stringstd/core/types/string: V

Convert a character to a string.

fun listchar/string( cs : liststd/core/types/list: V -> V<charstd/core/types/char: V> ) : stringstd/core/types/string: V

Convert a list of characters to a string.

fun maybe/string( ms : maybestd/core/types/maybe: V -> V<stringstd/core/types/string: V> ) : stringstd/core/types/string: V

Convert a maybestd/core/types/maybe: V -> V string to a string using the empty sting for Nothingstd/core/types/Nothing: forall<a> maybe<a>.

fun splitn/split( s : stringstd/core/types/string: V, sep : stringstd/core/types/string: V, ^n : intstd/core/types/int: V ) : liststd/core/types/list: V -> V<stringstd/core/types/string: V>

Split a string into at most n parts that were delimited by a string sep. The delimeters are not included in the results (except for possibly the final part). For example: split("1,2,3",",",2) == ["1","2,3"].

fun stringpat/count( s : stringstd/core/types/string: V, pattern : stringstd/core/types/string: V ) : intstd/core/types/int: V

Count occurrences of pattern in a string.

fun vector/join( v : vectorstd/core/types/vector: V -> V<stringstd/core/types/string: V> ) : stringstd/core/types/string: V

Concatenate a vector of strings.

fun vector/string( vectorstd/core/types/vector: V -> V<charstd/core/types/char: V> ) : stringstd/core/types/string: V

Convert a vector of characters to a string.

fun vectorsep/join( v : vectorstd/core/types/vector: V -> V<stringstd/core/types/string: V>, sep : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Concatenate a vector of strings with a separator sep.

fun (!=)( stringstd/core/types/string: V, stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Are two strings not equal?

fun (<)( ^x : stringstd/core/types/string: V, ^y : stringstd/core/types/string: V ) : boolstd/core/types/bool: V
fun (<=)( ^x : stringstd/core/types/string: V, ^y : stringstd/core/types/string: V ) : boolstd/core/types/bool: V
fun (==)( stringstd/core/types/string: V, stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Are two strings equal? Uses exact equality between character codes.

fun (>)( ^x : stringstd/core/types/string: V, ^y : stringstd/core/types/string: V ) : boolstd/core/types/bool: V
fun (>=)( ^x : stringstd/core/types/string: V, ^y : stringstd/core/types/string: V ) : boolstd/core/types/bool: V
fun (||)( x : stringstd/core/types/string: V, y : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Choose a non-empty string.

fun cmp( ^x : stringstd/core/types/string: V, ^y : stringstd/core/types/string: V ) : orderstd/core/types/order: V

Compare two strings. Uses the character codes directly for comparison.

fun contains( s : stringstd/core/types/string: V, sub : stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Does string s contain the string sub?

fun count( s : stringstd/core/types/string: V ) : intstd/core/types/int: V

O(n). Return the number of characters in a string.

fun is-empty( s : stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Is a string empty?

fun is-notempty( s : stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Is a string not empty?

fun list( s : stringstd/core/types/string: V ) : liststd/core/types/list: V -> V<charstd/core/types/char: V>

Convert a string to a list of characters.

fun maybe( s : stringstd/core/types/string: V ) : maybestd/core/types/maybe: V -> V<stringstd/core/types/string: V>

Transform a string to a maybe type, using Nothingstd/core/types/Nothing: forall<a> maybe<a> for an empty string.

fun order2( x : stringstd/core/types/string: V, y : stringstd/core/types/string: V ) : (stringstd/core/types/string: V, stringstd/core/types/string: V)
fun pad-left( s : stringstd/core/types/string: V, ^width : intstd/core/types/int: V, fill : ? charstd/core/types/char: V ) : stringstd/core/types/string: V

Right-align a string to width width using fill (default is a space) to fill from the left.

fun pad-right( s : stringstd/core/types/string: V, ^width : intstd/core/types/int: V, fill : ? charstd/core/types/char: V ) : stringstd/core/types/string: V

Left-align a string to width width using fill (default is a space) to fill on the right.

fun repeat( s : stringstd/core/types/string: V, ^n : intstd/core/types/int: V ) : stringstd/core/types/string: V

Repeat a string n times.

fun replace-all( s : stringstd/core/types/string: V, pattern : stringstd/core/types/string: V, repl : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Replace every occurrence of pattern to repl in a string.

fun split( s : stringstd/core/types/string: V, sep : stringstd/core/types/string: V ) : liststd/core/types/list: V -> V<stringstd/core/types/string: V>

Split a string into parts that were delimited by sep. The delimeters are not included in the results. For example: split("1,,2",",") == ["1","","2"].

fun to-lower( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Convert a string to lower-case.

fun to-upper( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Convert a string to upper-case.

fun trim( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Trim whitespace on the left and right side of a string.

fun trim-left( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Trim the starting white space of a string.

fun trim-right( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Trim the ending white space of a string.

fun vector( s : stringstd/core/types/string: V ) : vectorstd/core/types/vector: V -> V<charstd/core/types/char: V>

Convert a string to a vector of characters.

private import std/core/typesstd/core/types, std/core/hndstd/core/hnd, std/core/intstd/core/int, std/core/orderstd/core/order, std/core/vectorstd/core/vector