BullScript: Text Functions

Left

Usage

LEFT(TEXT,N)
text
Some text, such as a company name
n
The number of characters to return.

Description

Returns the n left most characters of text. If n is larger than the number of characters in text then text is returned.

Remarks

The text functions work with text data, which can be:

  • used as a symbol for the loadsymbol function
  • displayed on a chart with the text Linestyle
  • shown in a BullScan report

Example

left(“NCPDP”,3) returns “NCP”

See Also

Right | Substring | Text data type

Right

Usage

RIGHT(TEXT,N)
text
Some text, such as a company name
n
The number of characters to return.

Description

Returns the n right most characters of text. If n is larger than the number of characters in text then text is returned.

Remarks

The text functions work with text data, which can be:

  • used as a symbol for the loadsymbol function
  • displayed on a chart with the text Linestyle
  • shown in a BullScan report

Example

left(“GPTDA”,2) returns “DA”

See Also

Left | Linestyle | Substring | Text data type

SubString

Usage

SUBSTRING(TEXT,START[,N])
text
Some text, such as a company name.
start
The location to start collecting characters from. The first character is at position 1.
n
The number of characters to return.

Description

Returns n characters from text, starting from position start, where the first character is position 1. If n is omitted then everything after the first character is returned.

Remarks

The text functions work with text data, which can be:

  • used as a symbol for the loadsymbol function
  • displayed on a chart with the text Linestyle
  • shown in a BullScan report

Example

left(“GPTDA”,4) returns “DA”
left(“GPTDA”,4,1) returns “D”
left(“BullCharts”,5,5) returns “Chart”

See Also

Left | Right | Text data type

ToLower

Usage

TOLOWER(TEXT)
text
Some text, such as a company name.

Description

Converts the text to be fully lowercase.

Remarks

The text functions work with text data, which can be:

  • used as a symbol for the loadsymbol function
  • displayed on a chart with the text Linestyle
  • shown in a BullScan report

Example 1

tolower(“Yes”) returns “yes”

See Also

Text data type | ToUpper

ToUpper

Usage

TOUPPER(TEXT)
text
Some text, such as a company name.

Description

Converts the text to be fully uppercase.

It can often be helpful to use ToUpper with InputTextto ensure that comparisons work as expected.

Remarks

The text functions work with text data, which can be:

  • used as a symbol for the loadsymbol function
  • displayed on a chart with the text Linestyle
  • shown in a BullScan report

Example 1

toupper(“yes”) returns “YES”

Example 2

position := inputtext(“L=long, S=short”);
if ( toupper(trim(position))=”L”, Low-1, High+1);

See Also

Text data type | ToLower | Trim

Trim

Usage

TRIM(TEXT)
text
Some text, such as the results of inputtext.

Description

Removes any leading and trailing spaces from the text.

It can often be helpful to trim text entered using InputTextas accidentally entered spaces may cause your program to

Remarks

The text functions work with text data, which can be:

  • used as a symbol for the loadsymbol function
  • displayed on a chart with the text Linestyle
  • shown in a BullScan report

Example 1

trim(” yes “) returns “yes”

Example 2

position := inputtext(“L=long, S=short”);
if ( toupper(trim(position))=”L”, Low-1, High+1);

See Also

Left | Right | Text data type | ToUpper | ToLower

Was this article helpful?

Related Articles