字符串操作:
var str = document.getElementById("txt").value;
var regexRN = new RegExp("\r\n+","g");
var keys = str.split(regexRN);
showmsg(keys.length);
showmsg(keys.join("|"));
var regexRN = new RegExp("\r\n+","g");
var keys = str.split(regexRN);
showmsg(keys.length);
showmsg(keys.join("|"));
去空格:
String.prototype.Trim = function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LTrim = function()
{
return this.replace(/(^\s*)/g, "");
}
String.prototype.Rtrim = function()
{
return this.replace(/(\s*$)/g, "");
}
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LTrim = function()
{
return this.replace(/(^\s*)/g, "");
}
String.prototype.Rtrim = function()
{
return this.replace(/(\s*$)/g, "");
}