Painting Blue Code
Simple, self-explanatory code snippets.
2014-01-02
Javascript - String global replacements
var value = "
a
sdf
a
sdf";
value = value.
replace(/
a
/g,"
@
");
console.log('value: [' + value + ']' );
This statement would only replace the first instance found:
value = value.replace("a", "@");
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment