all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
function stripComments(s) {
|
||||
var re1 = /^\s+|\s+$/g; // Strip leading and trailing spaces
|
||||
var re2 = /\s*[#;].+$/g; // Strip everything after # or ; to the end of the line, including preceding spaces
|
||||
return s.replace(re1,'').replace(re2,'');
|
||||
}
|
||||
|
||||
|
||||
var s1 = 'apples, pears # and bananas';
|
||||
var s2 = 'apples, pears ; and bananas';
|
||||
|
||||
alert(stripComments(s1) + '\n' + stripComments(s2));
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
var stripComments = (function () {
|
||||
var re1 = /^\s+|\s+$/g;
|
||||
var re2 = /\s*[#;].+$/g;
|
||||
return function (s) {
|
||||
return s.replace(re1,'').replace(re2,'');
|
||||
};
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue