strtruncr#
Purpose#
Truncates the right side of all elements of a string array by a user-specified number of characters.
Format#
- y = strtruncr(sa, ntrunc)#
- Parameters:
sa (NxM or Nx1, 1xM, or 1x1 string array.) – data
ntrunc (NxM or Nx1, 1xM, or 1x1 matrix) – the number of characters to strip.
- Returns:
y (string array) – contains contents of sa with the ntrunc characters stripped from the right side.
Examples#
sa = "Hello World" $| "GAUSS";
// Remove 6 characters from the right
y = strtruncr(sa, 6);
print y;
The code above produces the following output:
Hello
Source#
strfns.src
See also
Functions strtriml(), strtrimr(), strtrunc(), strtruncl(), strtruncpad()