...

View Full Version : Is it posable to Convert the Char "a" to say "b"



barkermn01
12-13-2007, 03:27 PM
hello


var String = "hat and a bat"

Can i canovert the a's to a b's uing javascript

Kor
12-13-2007, 03:40 PM
Yes, on using Regular Expressions
http://lawrence.ecorp.net/inet/samples/regexp-intro.php


<script type="text/javascript">
var string = "hat and a bat";
string=string.replace(/a/g,'b');
alert(string)
</script>

Note: String is a reserved javascript word. Don't use it as a name, id, custom function, method, variable or argument.

barkermn01
12-13-2007, 04:04 PM
Thanks and i know that it was just an exsample lol



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum