SetStringMid , StringMid , String, Atom , ConcatStrings , LocalSymbols , PatchString .

# String manipulation

SetStringMid | change a substring
StringMid | retrieve a substring
String, Atom | convert atom to string and vice versa
ConcatStrings | concatenate strings
LocalSymbols | create unique local symbols with given prefix
PatchString | execute commands between `<?` and `?>` in strings

###

SetStringMid -- change a substring

##### Internal function

##### Calling format:

    SetStringMid(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> SetStringMid(3,"XY","abcdef")
    Out> "abXYef";

##### See also:

StringMid , Length .

###

StringMid -- retrieve a substring

##### Internal function

##### Calling format:

    StringMid(index,length,string)

##### Parameters:

`index` -- index of substring to get

`length` -- length of substring to get

`string` -- string to get substring from

##### Description:

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

##### Examples:

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

##### See also:

SetStringMid , Length .

###

String, Atom -- convert atom to string and vice versa

##### 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:

: .

###

LocalSymbols -- create unique local symbols with given prefix

##### Standard library

##### Calling format:

    LocalSymbols(var1, var2, ...) body

##### Parameters:

`var1`, `var2`, ... -- atoms, symbols to be made local

`body` -- expression to execute

##### Description:

Given the symbols passed as the first arguments to LocalSymbols a set of local symbols will be created, and creates unique ones for them, typically of the form `$<symbol><number>`, where `symbol` was the symbol entered by the user, and `number` is a unique number. This scheme was used to ensure that a generated symbol can not accidentally be entered by a user.

This is useful in cases where a guaranteed free variable is needed, for example, in the macro-like functions (`For`, `While`, etc.).

##### Examples:

    In> LocalSymbols(a,b)a+b
    Out> $a6+ $b6;

##### See also:

UniqueConstant .

###

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 .