Date

“String” Methods

_.endsWith([string=''], [target], [position=string.length])

source npm package

Checks if string ends with the given target string.

引入版本

3.0.0

参数
[string=''] (string) : The string to inspect.
[target] (string) : The string to search for.
[position=string.length] (number) : The position to search up to.

返回值
(boolean) : Returns true if string ends with target, else false.

示例
_.endsWith('abc', 'c');
// => true
 
_.endsWith('abc', 'b');
// => false
 
_.endsWith('abc', 'b', 2);
// => true