JavaScript javascript字符串方法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript javascript字符串方法相关的知识,希望对你有一定的参考价值。

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

以上是关于JavaScript javascript字符串方法的主要内容,如果未能解决你的问题,请参考以下文章