String manipulation

StringMid'Set(index, substring, string)

change a substring

Parameters:
  • index – index of substring to get
  • substring – substring to store
  • string – string to store substring in

Set (change) a part of a string. It leaves the original alone, returning a new changed copy.

Example:
In> StringMid'Set(3,"XY","abcdef")
Out> "abXYef";
StringMid'Get(index, length, string)

retrieve a substring

Parameters:
  • index – index of substring to get
  • length – length of substring to get
  • string – string to get substring from

{StringMid’Get} returns a part of a string. Substrings can also be accessed using the {[]} operator.

Example:
In> StringMid'Get(3,2,"abcdef")
Out> "cd";
In> "abcdefg"[2 .. 4]
Out> "bcd";
Atom("string")

convert string to atom

Parameters:"string" – a string

Returns an atom with the string representation given as the evaluated argument. Example: {Atom(“foo”);} returns {foo}.

Example:
In> Atom("a")
Out> a;

See also

String()

String(atom)

convert atom to string

Parameters:atom – an atom

{String} is the inverse of {Atom}: turns {atom} into {“atom”}.

Example:
In> String(a)
Out> "a";

See also

Atom()

ConcatStrings(strings)

concatenate strings

Parameters:strings – one or more strings

Concatenates strings.

Example:
In> ConcatStrings("a","b","c")
Out> "abc";

See also

Concat()

PatchString(string)

execute commands between {<?} and {?>} in strings

Parameters:string – a string to patch

This function does the same as PatchLoad, but it works on a string instead of on the contents of a text file. See PatchLoad for more details.

Example:
In> PatchString("Two plus three is <? Write(2+3); ?> ");
Out> "Two plus three is 5 ";

See also

PatchLoad()