检测子字符串是否在主字符串的尾部。
- Source:
Example
str.endsWith('foobar', 'bar') // true
str.endsWith('foobar', 'f') // false
str.endsWith('foobar', 'barr') // false
str.endsWith('foobar', 'bar', 5) // false
str.endsWith('foobar', 'bar', 6) // true
str.endsWith(12345, 45) // true
str.endsWith(12345, 6) // false
str.endsWith(12345, 34, 4) // true
str.endsWith(12345, 45, 4) // false
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
str |
String | 主字符串 | ||
subStr |
String | 子字符串 | ||
n |
Number |
<optional> |
str.length
|
表示检测前n项 |
Returns:
true,表示在尾部;false,表示不在尾部
- Type
- Boolean