Sidechair

str.upper()

Browse the reference

Returns a string with every letter converted to upper case.

Try it in the editor

str.upper changes lower-case letters to upper case. Digits, symbols and spaces stay as they are.

Use it to display a tidy label from user text, or to compare against an upper-case constant.

Syntax

Pine Script
str.upper(source: const string) -> const string
str.upper(source: simple string) -> simple string
str.upper(source: series string) -> series string

Arguments

NameTypeDefaultDescription
sourceconst/simple/series stringrequiredThe text to turn into upper case. Characters without a case stay as they are.

Returns

const/simple/series string: the upper-case text.

Remarks

  • It does not trim spaces. Combine it with str.trim for cleaned input.

Example

Pine ScriptMatch an upper-case codeOpen in editor
//@version=6
indicator("Upper")
code = input.string("nvda", "Code")
plot(str.upper(code) == syminfo.ticker ? 1 : 0, "Matches chart", color = color.orange, style = plot.style_stepline)

See also

Runs on Sidechair