...
Code Block |
---|
language | javascript |
---|
theme | Confluence |
---|
|
my_str = "This is a string";
a = my_str.match(re/is/re#is#) // a = true
b = my_str.match(re/mouse/re#mouse#) // b = false |
ord()
The ord()
operator returns a numeric ASCII value of the first character in the string on which it operates. For example:
...
Code Block |
---|
language | javascript |
---|
theme | Confluence |
---|
|
my_str = "This is a string";
my_url = "http://www.amazon.com/gp/products/123456789/";
a = my_str.replace(re/is/re#is#,"ese"); // a = "These is a string"
b = my_str.replace(re/is/gre#is#g,"ese"); // b = "These ese a string"
c = my_str.replace(re/this/re#this#,"That"); // c = "This is a string" (no change)
d = my_str.replace(re/this/ire#this#i,"That"); // d = "That is a string"
e = my_url.replace(re#^http://(\[A-Za-z0-9.-\]+)/.*#,"$1"); // e = "www.amazon.com" |
...
Code Block |
---|
language | javascript |
---|
theme | Confluence |
---|
|
a = "A;B;C"
c = a.split(re/re#;/#) // c = ["A","B","C"] |
sprintf()
...