String manipulation¶
-
StringMid'Set
(index, substring, string)¶ change a substring
- Param index
index of substring to get
- Param substring
substring to store
- Param 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";
See also
-
StringMid'Get
(index, length, string)¶ retrieve a substring
- Param index
index of substring to get
- Param length
length of substring to get
- Param 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";
See also
-
Atom
("string")¶ convert string to atom
- Param “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
(atom)¶ convert atom to string
- Param atom
an atom
{String} is the inverse of {Atom}: turns {atom} into {“atom”}.
- Example
In> String(a) Out> "a";
See also
-
ConcatStrings
(strings)¶ concatenate strings
- Param strings
one or more strings
Concatenates strings.
- Example
In> ConcatStrings("a","b","c") Out> "abc";
See also
-
PatchString
(string)¶ execute commands between
<?
and?>
in strings- Param 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. SeePatchLoad()
for more details.- Example
In> PatchString("Two plus three is <? Write(2+3); ?> "); Out> "Two plus three is 5 ";
See also