Lipi Reference Lipi

Functions

str.tonumber()

Converts a value represented in string to its "float" equivalent.

Syntax · 1 of 4

                str.tonumber(const string source) → const float
              

Arguments

source required const string String containing the representation of an integer or floating point value.

Return Type

const float

Syntax · 2 of 4

                str.tonumber(input string source) → input float
              

Arguments

source required input string String containing the representation of an integer or floating point value.

Return Type

input float

Syntax · 3 of 4

                str.tonumber(simple string source) → simple float
              

Arguments

source required simple string String containing the representation of an integer or floating point value.

Return Type

simple float

Syntax · 4 of 4

                str.tonumber(series string source) → series float
              

Arguments

source required series string String containing the representation of an integer or floating point value.

Return Type

series float

Example


          indicator("String to Number Example", overlay=false)
numStr1 = "123.45"
numStr2 = "456"
num1 = str.tonumber(numStr1)
num2 = str.tonumber(numStr2)
plot(num1, title="Converted Number 1")
plot(num2, title="Converted Number 2")