What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-19 10:15:11
string methods javascript count number of words inside a string
<html> <body> <script> function countWords(str) { str = str.replace(/(^\s*)|(\s*$)/gi,""); str = str.replace(/[ ]{2,}/gi," "); str = str.replace(/\n /,"\n"); return str.split(' ').length; }... Add solution -
PHP 2022-03-18 02:10:01
add slashes to string
str = str.replace(/'/g, "\\'"); Add solution