First character, middle and end of a string: head mid tail

### 6.3.5 First character, middle and end of a string: head mid tail

The head command finds the first character of a string.

- head takes one argument:
  str, a string.
- head(str) returns the first character of the string str.

Example.
Input:

head("Hello")

Output:

"H"

The mid command finds a selected part from the middle of a string.

- mid takes three arguments:
  - str, a string.
  - p, an integer for the starting index of the result.
  - q, an integer q for the length of the string.
- mid(str,p,q) returns the part of the string str starting with the character at index p with length q. (Remember that the first index is 0 in Xcas mode.)

Example.
Input:

mid("Hello",1,3)

Output:

"ell"

The tail command removes the first character of a string.

- tail takes one argument:
  str, a string.
- tail(str) returns the string str without its first character.

Input:

tail("Hello")

Output:

"ello"