# Transforming a string into a number: expr

### 5.3.14 Transforming a string into a number: expr

The expr command transforms a string representing a valid Xcas statement into the actual statement.

- expr takes one argument:
  str, a string corresponding to an Xcas statement.
- expr(str) evaluates the statement.

#### Examples.

- Input:
  expr("a:=1")
  Output:

  1

  Then:
  Input:
  a
  Output:

  1

  In particular, expr can transform a string representing a number into the number (see Section 4.1).
- Input:
  expr("123")
  Output:

  123

- Input:
  expr("0123")
  Output:

  83

  since 0123 represents a base 8 integer (see Section 5.4.1) and 1· 82+2· 8+3=83.
- Input:
  expr("0x12f")
  Output:

  303

  since 0x12f represents a base 16 number and 1*162+2*16+15=303.
- Input:
  expr("123.4567")
  Output:

  123.4567

- Input:
  expr("123e-5")
  Output:

  0.00123