Trimstr – Visara Master Console Center Scripting Guide User Manual
Page 204
![background image](https://www.manualsdir.com/files/808700/content/doc204.png)
Chapter 5 Script Commands
Scripting Guide
204
TRIMSTR
Syntax:
TRIMSTR( $String[, %Where]) ==> $Trimmed
Description:
Removes leading and trailing spaces from a string.
Action:
Returns a character string with leading and/or trailing space
characters removed, depending on the %Where parameter.
Parameters:
$String. String expression. The string to remove leading and/or
trailing spaces from.
%Where. Numeric expression. Optional. Where to remove the spaces
from. Valid constants are BOTH, LEFT, and RIGHT. If not specified,
the default %Where is BOTH.
-
BOTH removes leading and trailing spaces. Equivalent to using
both LEFT and RIGHT on
the same string: TRIMSTR(
TRIMSTR( $String, LEFT), RIGHT)
-
LEFT removes leading spaces only.
-
RIGHT removes trailing spaces only.
Returns:
String value. The string with leading and/or trailing spaces removed.
Notes:
N/A
Example:
//create a string of spaces
$Spaces := REPSTR( “ ”, 10)
//create a string containing leading and trailing spaces
$String := $Spaces + “string” + $Spaces
%Len := LEN( $String)
// 26
%Len := LEN(TRIMSTR( $String))
// 6
$Trimmed := TRIMSTR( $String, LEFT))
%Len := LEN( $Trimmed)
// 16
See Also: