You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
523 B
JavaScript
18 lines
523 B
JavaScript
function string_endsWith(str, suffix)
|
|
{
|
|
|
|
if (((str===null) || (str==='')) || ((suffix===null) || (suffix==='')))
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
str = str.toString();
|
|
suffix = suffix.toString();
|
|
}
|
|
return str.indexOf(suffix, str.length - suffix.length) !== -1;
|
|
}
|
|
|
|
console.log(string_endsWith('JS PHP PYTHON','PYTHON'));
|
|
|
|
console.log(string_endsWith('JS PHP PYTHON',''));
|