inside script tag,
var data = "Helloo Good Morning";
startsWith
String.prototype.startsWith = function(data)
{
return (this.match("^"+data)==data)
}
eg:
data.startsWith("Helloo");
returns true
-----------------------------------------------------------------------
endsWith
String.prototype.endsWith = function(data)
{
return (this.match(data+"$")==data)
}
eg:
data.endsWith("Helloo");
returns false;
----------------------------------------------------------
trim
String.prototype.trim = function()
{
return (this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""))
}
eg:
var tm = data.trim();
for more ...
http://www.tek-tips.com
Subscribe to:
Post Comments (Atom)
1 comment:
Hello nice one. really useful information
Post a Comment