WoW API: strtrim

From AddOn Studio
Revision as of 13:31, 19 July 2007 by WoWWiki>Egingell (New page: {{wowapi}} Trim characters (''chars''), off the left and right of ''str'' local newstr = strtrim(str[, chars]) == Arguments == :(str[, chars]) :;str: String - The input string. :;chars:...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

WoW API < strtrim

Trim characters (chars), off the left and right of str

local newstr = strtrim(str[, chars])

Arguments

(str[, chars])
str
String - The input string.
chars
String - A list of characters to remove from the left and right of str.
If left off, it defaults to " \t" ([space][tab]).
If adding this argument, please note that spaces will not be trimmed unless you include one with the other characters ("123" is not the same as " 123").


Returns

newstr
String - The modified string.


Example

str = "///All debug and no play, make Eric go crazy.\n\n"
a = strtrim(str, "/\n");
DEFAULT_CHAT_FRAME:AddMessage(a);

Result

All debug and no play, make Eric go crazy.