Lipi Reference Lipi

Functions

str.substring()

Returns a new string that is a substring of the source string. The substring begins with the character at the index specified by begin_pos and extends to 'end_pos - 1' of the source string.

Syntax · 1 of 8

                str.substring(const string source, const int start, const int end) → const string
              

Arguments

source required const string The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the source string.
start required const int The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).
end required const int Source string from which to extract the substring.

Return Type

const string

Syntax · 2 of 8

                str.substring(input string source, input int start, input int end) → input string
              

Arguments

source required input string The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the source string.
start required input int The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).
end required input int Source string from which to extract the substring.

Return Type

input string

Syntax · 3 of 8

                str.substring(simple string source, simple int start, simple int end) → simple string
              

Arguments

source required simple string The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the source string.
start required simple int The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).
end required simple int Source string from which to extract the substring.

Return Type

simple string

Syntax · 4 of 8

                str.substring(series string source, series int start, series int end) → series string
              

Arguments

source required series string The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the source string.
start required series int The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).
end required series int Source string from which to extract the substring.

Return Type

series string

Syntax · 5 of 8

                str.substring(const string source, const int start) → const string
              

Arguments

source required const string The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the source string.
start required const int The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).

Return Type

const string

Syntax · 6 of 8

                str.substring(input string source, input int start) → input string
              

Arguments

source required input string The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the source string.
start required input int The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).

Return Type

input string

Syntax · 7 of 8

                str.substring(simple string source, simple int start) → simple string
              

Arguments

source required simple string The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the source string.
start required simple int The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).

Return Type

simple string

Syntax · 8 of 8

                str.substring(series string source, series int start) → series string
              

Arguments

source required series string The ending position. It is exclusive (the extracted string does NOT include that position's character). Optional. The default is the length of the source string.
start required series int The beginning position of the extracted substring. It is inclusive (the extracted substring includes the character at that position).

Return Type

series string

Example


          indicator("String Substring Example", overlay=false)
myStr = "GoCharting is powerful"
subStr = str.substring(myStr, 0, 10)
plot(close, title=subStr)