subStr Function

Retrieves part of a string.


str subStr(str _text, int _position, int _number)

Parameter

Description

_text

The original string.

_position

The position in the original string where the part to retrieve begins.

_number

A signed integer that indicates the direction and number of positions to retrieve from the original string.

If there is a minus sign preceding _number, the system selects the substring backward from the specified position.

A substring of the original string.

If there is a minus sign before the value of the _number parameter, the substring will be selected backward from the specified position.

  • subStr("ABCDEFGHIJ",3,5); //Returns the string “CDEFG”.

  • subStr("ABCDEFGHIJ",7,-4); //Returns the string “DEFG”.

  • subStr(“abcdef”),2,99) //Returns the string “bcdef”.

  • subStr(“abcdef”,2,3) //Returns the string “bcd”.

  • subStr(“abcdef”,2,-3); //Returns the string “ab”.

Community Additions

ADD
Show: