The left() Command

left.png

Command Summary

Returns a subsection from the left of a list or string, or the left hand side of an equation.

Command Syntax

left(equation)
left(list-or-string,length)

Menu Location

  • Press 2nd MATH to enter the MATH popup menu.
  • Press 3 to enter the List submenu.
  • Press 9 to select left(.

Calculator Compatibility

This command works on all calculators.

Token Size

2 bytes

When applied to a list or a string, left(x,length) gets the first length elements/characters of x. This is an alternative to mid(), which will do the same thing from any point in the list or string, not just the beginning.

When applied to an equation (such as x=5) or an inequality (such as x<3), left() returns the left-hand side of the equation. This only works for equations that don't get simplified: left(2+2=4) will not work, because 2+2=4 will return 'true' first.

:left({1,2,3,4,5},3)
           {1  2  3}
:left("TI-Basic Developer",8)
           "TI-Basic"
:left(x^2+2x+1>0)
           x^2+2*x+1
:left({1,2,3,4,5},0)
           {}

Optimization

Use left() instead of mid() when the substring starts at the beginning of the list or string.

Error Conditions

260 - Domain error happens when the argument is not a list, string, or equation, or is an equation that has simplified.

Related Commands

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License