Skip to content

strtrimright

strings · scripts/strings/strtrimright.m

: s = strtrimright (s)

Strip blanks from the right end of text.

Whitespace at the end of s is removed. For a character matrix the trailing columns that are blank in every row are dropped. A cell array is processed element by element, descending into nested cells.

strtrimright ("   hello world  ")
     ⇒   "   hello world"

strtrimright (['ab   '; ' cde '])
     ⇒   ["ab  "; " cde"]