lastIndexOf

返回第二个参数在第一个参数中最后一次出现的位置。 如果没有匹配项,则返回–1。

类别

字符串

函数语法

lastIndexOf(<parameters>)

参数

参数 类型
字符串 字符串
指定值 字符串

签名和返回的类型

lastIndexOf(<string>,<string>)

返回整数。

示例

lastIndexOf("Hello, "l")

返回3。

解释:

在“Hello”中,“l”的最后一次出现在位置3。

在此页面上