Characters and strings

### 5.2.1 Characters and strings

Strings are delimited with quotation marks ("). A character is a string of length one.

Do not confuse " with ’ which is used to prevent evaluation of an expression (see Section 9.1.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 5.2.13).

#### Examples

"Hello"

“Hello” |  |  |  |  |  |  |  |  |  |

"Hello"+", how are you?"

“Hello, how are you?” |  |  |  |  |  |  |  |  |  |

"Hello"+ 123

“Hello123” |  |  |  |  |  |  |  |  |  |

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

#### Example

"Hello"[1]

“e” |  |  |  |  |  |  |  |  |  |