admin管理员组文章数量:1389841
I have a variable which contains the following string
placeholder = "<strong>Total Damage:</strong> $70,000.00"
Now, I am trying to replace Dollor sign($) with pound sign(£). Any idea how this can be done?
[Edit]
I don't know javascript, still trying to learn. now the solution seems so simple, I feel embarrassed now. Sorry for bothering everyone with such silly question :(
I have a variable which contains the following string
placeholder = "<strong>Total Damage:</strong> $70,000.00"
Now, I am trying to replace Dollor sign($) with pound sign(£). Any idea how this can be done?
[Edit]
I don't know javascript, still trying to learn. now the solution seems so simple, I feel embarrassed now. Sorry for bothering everyone with such silly question :(
Share Improve this question edited Jan 11, 2012 at 16:27 CuriousMind asked Jan 11, 2012 at 16:19 CuriousMindCuriousMind 34.2k29 gold badges100 silver badges141 bronze badges 3-
3
Googling
javascript replace character
should give you everything you need. – Pekka Commented Jan 11, 2012 at 16:20 - 1 possible duplicate of Javascript replace a character with a space – Rob Hruska Commented Jan 11, 2012 at 16:24
- Also see this answer – Rob Hruska Commented Jan 11, 2012 at 16:25
3 Answers
Reset to default 4placeholder = placeholder.replace("$","£");
Simples!
Really?
JavaScript Replace
var myNewString = myOldString.replace("something", "new thing");
placeholder = "<strong>Total Damage:</strong> $70,000.00".replace("$","£");
本文标签: How to change single char from string in JavaScriptStack Overflow
版权声明:本文标题:How to change single char from string in JavaScript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744741673a2622644.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论