Removes any whitespace from the both ends of a string
Device + Agent
Name | Type | Description |
---|---|---|
stringToStrip | String |
Any string
|
String — the truncated string
This function removes any and all space characters from both the beginning and the end of the passed string. It returns the result as a new string, leaving the original string intact.
Because strip() is implemented as a function, it does not use dot syntax.
local aString = " This string starts and ends with rogue spaces "; | |
local newString = strip(aString); | |
server.log(newString); | |
// Displays "This string starts and ends with rogue spaces" |