str.trim() - Pine Script Function
str.trim()
Section titled “str.trim()”Overview
Section titled “Overview”Constructs a new string with all consecutive whitespaces and other control characters (e.g., “\n”, “\t”, etc.) removed from the left and right of the source.
Syntax
Section titled “Syntax”str.trim(source) → const stringParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| source | const string | String to trim. |
Remarks
Section titled “Remarks”- Returns an empty string ("") if the result is empty after the trim or if the source is na.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("str.trim")trim = str.trim(" abc ") // Returns "abc"label.new(bar_index,close,trim)