Ion Fusion Documentation
Release 0.38a1-SNAPSHOT (2026-04-16T19:45:37.790Z)

Module /fusion/string

Operations for strings.

Mirroring Ion, a Fusion string is a Unicode coded character sequence.

At this time, the core libraries do not treat string as one of the sequence types, to avoid surprising performance complexity when addressing elements of the sequence. Specifically, indexed access to a selected character in a string takes O(n) time, since the implementation is unlikely to use the inefficient UTF-32 representation required for constant-time access.

is_string procedure
(is_string value)

Determines whether a value is of type string, returning true or false.

string_append procedure
(string_append text ...)

Concatenates the text values (strings or symbols), returning a string. All arguments must be actual strings or symbols, not null.

If no arguments are supplied, the result is "".

string_contains procedure
(string_contains string substring)

Returns true if and only if string contains the substring. Both arguments must be actual strings.

string_ends_with procedure
(string_ends_with string suffix)

Returns true if and only if string ends with suffix. Both arguments must be actual strings.

string_is_lower procedure
(string_is_lower string)

Returns whether string contains only lower-case code points.

A list of lower-case code points can be found online.

string_is_upper procedure
(string_is_upper string)

Returns whether string contains only upper-case code points.

A list of upper-case code points can be found online.

string_join procedure
(string_join separator part ...)

Appends the parts in order into a single string, inserting the separator between adjacent parts. All arguments must be actual strings or symbols.

No separator is added before or after the result. If no parts are supplied, the result is "".

string_replace procedure
(string_replace string from to)

Replaces all occurrences of from with to that occur in string. The string must be a nullable string; null.string is returned as-is. from and to must be actual strings.

Replacement uses literal matching (no regular expressions) and proceeds from the beginning of the string to the end. For example (string_replace "aaa" "aa" "b") will evaluate to "ba".

Replacement when from is an empty string will insert to before, between, and after each character in string. For example (string_replace "aa" "" "b") will evaluate to "babab". If string is also "" a string equal to to is returned.

string_split procedure
(string_split string separator)

Splits string into an immutable list of strings using separator. Both arguments must be actual strings.

Returns an empty list when string is an empty string.

DEPRECATED where separator is a regular expression. That behavior was unintentional, and in conflict with this library's design goal to have no dependency on the Java language or library.

  • Callers needing to split based on regular expressions should use regexp_split from the FusionJavaRegexp package, being careful to adapt code to that method's different argument order, result type (sexp instead of immutable list), and edge cases around leading matches. Test your code thoroughly.
  • Callers needing separators that are escaped to avoid being regular expressions should use string_split_noregexp until the regexp behavior is removed from this procedure. For example, replace:

    (string_split txt "\\.")
    

    with:

    (require "/fusion/experimental/string")
    (string_split_noregexp txt ".")
    
string_starts_with procedure
(string_starts_with string prefix)

Returns true if and only if string begins with prefix. Both arguments must be actual strings.

string_to_lower procedure
(string_to_lower string)

Converts all the characters in a string to lower-case letters.

string_to_symbol procedure
(string_to_symbol string)

Converts a string to a symbol with the same text. Returns null.symbol when given null.string.

string_to_upper procedure
(string_to_upper string)

Converts all the characters in a string to upper-case letters.

symbol_append procedure
(symbol_append text ...)

Concatenates the text values (strings or symbols), returning a symbol. All arguments must be actual strings or symbols, not null.

If no arguments are supplied, the result is "".

symbol_to_string procedure
(symbol_to_string symbol)

Converts a symbol to a string with the same text. Returns null.string when given null.symbol.

text_to_string procedure
(text_to_string t)

Normalizes a text value (string or symbol) to a string. Annotations are preserved and null.symbol is converted to null.string.