String manipulation

(directly go to documentation on : StringMid'Set, StringMid'Get, String, Atom, ConcatStrings, PatchString. )

# 29. String manipulation

StringMid'Set | change a substring
StringMid'Get | retrieve a substring
String | convert atom to string
Atom | convert string to atom
ConcatStrings | concatenate strings
PatchString | execute commands between `<?` and `?>` in strings

###

StringMid'Set -- change a substring

##### Internal function

##### Calling format:

    StringMid'Set(index,substring,string)

##### Parameters:

`index` -- index of substring to get

`substring` -- substring to store

`string` -- string to store substring in.

##### Description:

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

##### Examples:

    In> StringMid'Set(3,"XY","abcdef")
    Out> "abXYef";

##### See also:

StringMid'Get , Length .

###

StringMid'Get -- retrieve a substring

##### Internal function

##### Calling format:

    StringMid'Get(index,length,string)

##### Parameters:

`index` -- index of substring to get

`length` -- length of substring to get

`string` -- string to get substring from

##### Description:

`StringMid'Get` returns a part of a string. Substrings can also be accessed using the `[]` operator.

##### Examples:

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

##### See also:

StringMid'Set , Length .

###

String -- convert atom to string

###

Atom -- convert string to atom

##### Internal function

##### Calling format:

    Atom("string")
    String(atom)

##### Parameters:

`atom` -- an atom

`"string"` -- a string

##### Description:

Returns an atom with the string representation given as the evaluated argument. Example: `Atom("foo");` returns `foo`.

`String` is the inverse of `Atom`: turns `atom` into `"atom"`.

##### Examples:

    In> String(a)
    Out> "a";
    In> Atom("a")
    Out> a;

###

ConcatStrings -- concatenate strings

##### Internal function

##### Calling format:

    ConcatStrings(strings)

##### Parameters:

`strings` -- one or more strings

##### Description:

Concatenates strings.

##### Examples:

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

##### See also:

: .

###

PatchString -- execute commands between `<?` and `?>` in strings

##### Internal function

##### Calling format:

    PatchString(string)

##### Parameters:

`string` -- a string to patch

##### Description:

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

##### Examples:

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

##### See also:

PatchLoad .