|
-
Mar 21st, 2001, 12:55 PM
#1
Thread Starter
Member
I want to know if there is a function in Javascript that can replace charater by another one.....ex:
var htmlcontent;
htmlcontent ="hello world";
htmlcontent= replace(htmlcontent,o,i);
alert(htmlcontent);
and I want the alert to show "helli wirld". Is there a function that can do that???
-
Mar 21st, 2001, 03:15 PM
#2
Hyperactive Member
Regular expressions
Yeah, if you use regular expressions this will be easy.
var myString = "Hello World";
var results = myString.replace(/o/gi,"i");
alert(results);
regexpr is /texttolookfor/g is for globlal, i is for ignore case
Last edited by billrogers; Mar 21st, 2001 at 03:26 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|