lastIndexOf()

[StringObject Function]

Description

Locates a character or String within another String. By default, searches from the end of the String, but can also work backwards from a given index, allowing for the locating of all instances of the character or String.

Syntax

string.lastIndexOf(val)

string.lastIndexOf(val, from)

Parameters

string: a variable of type String

val: the value to search for - char or String

from: the index to work backwards from

Returns

The index of val within the String, or -1 if not found.

See also

  • LANGUAGE c_str()

  • LANGUAGE charAt()

  • LANGUAGE compareTo()

  • LANGUAGE concat()

  • LANGUAGE endsWith()

  • LANGUAGE equals()

  • LANGUAGE equalsIgnoreCase()

  • LANGUAGE getBytes()

  • LANGUAGE indexOf()

  • LANGUAGE length()

  • LANGUAGE remove()

  • LANGUAGE replace()

  • LANGUAGE reserve()

  • LANGUAGE setCharAt()

  • LANGUAGE startsWith()

  • LANGUAGE substring()

  • LANGUAGE toCharArray()

  • LANGUAGE toFloat()

  • LANGUAGE toInt()

  • LANGUAGE toLowerCase()

  • LANGUAGE toUpperCase()

  • LANGUAGE trim()