Trim PowerScript function
Description
Removes leading and trailing spaces from a string.
Syntax
|
1 |
<span>Trim</span> ( <span>string</span> <span></span>{, <span>removeallspaces</span> } ) |
|
Argument |
Description |
|---|---|
|
string |
The string you want returned with leading |
|
removeallspaces |
A boolean indicating that all types of |
Return Values
String. Returns a copy of string with
all leading and trailing spaces deleted if it succeeds and the empty
string (“”) if an error occurs. If string is null, Trim returns null.
Usage
Trim is useful for removing spaces that
a user may have typed before or after newly entered data.
If you do not include the optional removeallspaces argument
or its value is false, only the space character
(U+0020) is removed from the string.
If the removeallspaces argument is set
to true, all types of space characters are removed.
See LeftTrim for a list of space
characters.
Examples
This statement returns BABE RUTH if all the leading
and trailing spaces are space characters:
|
1 |
<span>Trim</span>(" BABE RUTH ") |
This statement returns BABE RUTH if the leading and
trailing spaces include other types of white space characters:
|
1 |
<span>Trim</span>(" BABE RUTH ", true ) |
This example removes the leading and trailing spaces
from the user-entered value in the SingleLineEdit sle_emp_fname and
saves the value in emp_fname:
|
1 |
string emp_fname |
|
1 |
emp_fname = <span>Trim</span>(sle_emp_fname.Text) |