Previous Up Next

6.3.1  Characters and strings: "

Strings are delimited with quotation marks, ". A character is a string of length one.
Do not confuse " with (or quote) which is used to prevent evaluation of an expression (see Section 6.12.4). For example, "a" returns a string with one character but ’a’ or quote(a) returns the variable a unevaluated.

When a string is entered on a command line, it is evaluated to itself, hence the output is the same string. You can use + to concatenate two strings or a string and another object (where the other object will be converted to a string, see Section 6.3.12).


Examples.


You can refer to a particular character of a string using index notation, like for lists (see Section 6.40). Indices begin at 0 in Xcas mode, 1 in other modes.


Example.
Input:

"Hello"[1]

Output:

"e"

Previous Up Next