From 376921a2bd5eecb6ed55d6ccacdc33673b751f3d Mon Sep 17 00:00:00 2001 From: Catouse Date: Sun, 4 May 2014 18:18:56 +0800 Subject: [PATCH] + added function 'isNum' in the string.js. --- src/js/string.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/js/string.js b/src/js/string.js index 7b35d8d6..be8a715d 100644 --- a/src/js/string.js +++ b/src/js/string.js @@ -35,3 +35,22 @@ String.prototype.format = function(args) } return result; }; + + +/** + * Judge the string is a integer number + * + * @access public + * @return bool + */ +String.prototype.isNum = function(s) +{ + if(s!=null) + { + var r, re; + re = /\d*/i; + r = s.match(re); + return (r == s) ? true : false; + } + return false; +} -- GitLab