I want to know if a string starts with the specified character/string or ends with it in jQuery.(我想知道一个字符串是以指定的字符/字符串开头还是以jQuery结尾。)
For Example:(例如:)
var str = 'Hello World';
if( str starts with 'Hello' ) {
alert('true');
} else {
alert('false');
}
if( str ends with 'World' ) {
alert('true');
} else {
alert('false');
}
If there is not any function then any alternative ?(如果没有任何功能那么任何替代方案?)
ask by Naveed translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…