str.trim

Removes whitespace from around a string and hands back the result. Which characters count as whitespace is not stated in this edition.

str.trim(const string source) → const string
str.trim(input string source) → input string
str.trim(series string source) → series string
str.trim(simple string source) → simple string
ParameterTypeRequiredDescription
sourceconst stringyesthe string to trim

Returns const string or input string or series string or simple string — A string in the form of the argument you pass.

indicator("Trimmed text")
alert(str.trim("  breakout  "))
plot(close)

See also str.contains · str.endswith · str.format_time

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade