Permalink
Browse files

commit stringUtil

提交stringUtil.js
  • Loading branch information...
1 parent 0f1d596 commit 2276f74a70bdd8fe34aff7b7bad44967c4cf024a @lenbo-ma committed Jan 30, 2013
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/stringUtil.js
View
@@ -0,0 +1,16 @@
+
+
+exports.trim = function(str)
+{
+ return str.replace(/(^\s*)|(\s*$)/g, "");
+}
+
+exports.ltrim = function(str)
+{
+ return str.replace(/(^\s*)/g, "");
+}
+
+exports.rtrim = function(str)
+{
+ return str.replace(/(\s*$)/g, "");
+}

0 comments on commit 2276f74

Please sign in to comment.