Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this Page

...

Description

Returns the index within the calling String object of the last occurrence of the specified value. The index of the first character is 0; -1 returns if the searchValue is not found.

This is similar to the JavaScript lastIndexOf.

Syntax


Code Block
string.lastIndexOf(searchValue[, fromIndex])


Example

Expression: $email.lastIndexOf("xe")

where $email is "vp@example.com"

Result: 410

length

Description

Returns the number of code units in the string.

This is similar to the JavaScript length.

Syntax


Code Block
string.length


Example

Expression: $first.length

where $first contains John

Result: 4

...

Description

Returns a new string with text extracted from another string.

If beginIndex is greater than or equal to the length of the string, an empty string is returned. If it is negative, it returns that many characters from the end of the string length.

If endIndex is omitted, slice() extracts to the end of the string. If it is a positive value, the string value is captured up to, but not including that character. If the value is negative, the capture extracts to that number of characters from the end.

This is similar to the JavaScript slice.

Syntax


Code Block
string.slice(beginIndex[, endIndex])

Example

Where $String contains "Copyright 2017 All rights reserved."

Expression: $String.slice(10)

Result: 2017 All rights reserved.


Expression: $String.slice(10,14)

Result: 2017


Expression: $String.slice(10,-2)

Result: 2017 All rights reserve


Expression: $String.slice(-2)

Result: d.


...