Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bf23f9e

Browse files
committed
New: Simple string validation.
1 parent 6edde49 commit bf23f9e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎basic/string.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,15 @@ console.log(first_name, middle_name, last_name);
3030

3131
var page = window.open('/path/to/pdf');
3232
console.log(page.print());
33+
34+
35+
// String validation
36+
var myString = "An /invalid &string;";
37+
var charList = ['/', '\\', '&', ';']; // etc...
38+
39+
function sanitize(input, list) {
40+
for (char in list) {
41+
input = input.replace(char, '');
42+
}
43+
return input
44+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /