code-in-time
05-29-2012, 06:55 PM
Hi
How do you replace a char in a string?
eg var d = f.replace(char(160), "-");
Thanks
How do you replace a char in a string?
eg var d = f.replace(char(160), "-");
Thanks
|
||||
how do you replace a char in a stringcode-in-time 05-29-2012, 06:55 PM Hi How do you replace a char in a string? eg var d = f.replace(char(160), "-"); Thanks Philip M 05-29-2012, 07:17 PM Something like this:- txt = txt.replace(/Ä/g,"-"); txt = txt.replace(/ä/g,"-"); txt = txt.replace(/Ë/g,"-"); txt = txt.replace(/ë/g,"-"); Or perhaps you mean:- <script type = "text/javascript"> var tstr = "Hello Ältere World"; var bstr = ''; for (i=0; i<tstr.length; i++) { if (tstr.charCodeAt(i)>127) { // outside ASCII range bstr += '-'; // change to a hyphen } else { bstr += tstr.charAt(i); } } alert (bstr); </script> Quizmaster: In legend, the gryphon has the body of a lion and the head and wings of which bird? Contestant: A goose |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum