Skip to content

left

First N characters of a string.

v = left(text, num_chars)

Returns the leftmost num_chars characters from text. Default num_chars is 1. Equivalent to MATLAB’s text(1:num_chars).

left('hello world', 5) % 'hello'
left('abc') % 'a'
  • right — Last N characters of a string.
  • mid — Substring starting at a given position.
  • leftb — First N bytes of a string.