Strings - Maple Programming Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Names and Strings : string




A string is a sequence of characters that has no value other than itself. It cannot be assigned to, and will always evaluate to itself. The maximum length of a string is system-dependent. On 32-bit platforms, it is 268,435,439 characters; on 64-bit platforms, it is 34,359,738,335 characters.


A string is written by enclosing any sequence of characters within a pair of double quote characters (" "). For example: "This is a string".


Strings may also be formed with the concatenation operator ``||'', or with the function cat.  See the help page for cat for more information.


Two successive double quotes that appear after the opening of a string are parsed as a single double quote.  Thus,  "abc""de" yields the string abc"de. Alternatively, a double quote can be written within a string by preceding it with a backslash, as in "abc\"de".


Two consecutive string constants, separated only by whitespace (spaces, tabs, or line breaks) are parsed as a single string, with the intervening double quotes and whitespace removed. Thus, "abc" "de" yields the same string as "abcde".


The type function understands the type string.


A symbol can be converted into a string by using convert(aSymbol, string). Likewise, a string can be converted into a symbol by using convert(aString, symbol). Alternatively, one can use convert(aString, name).


Strings are especially useful for messages, labels, and text.


For more information on working with strings, see the Using Strings in Maple example worksheet.


A number of efficient string manipulation primitives are provided in the StringTools package.


Substrings or individual characters can be accessed through an indexed selection.

See Also