How to change single char from string in JavaScript - Stack Overflow

I have a variable which contains the following stringplaceholder = "<strong>Total Damage:<

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
Add a ment  | 

3 Answers 3

Reset to default 4
placeholder = placeholder.replace("$","£");

Simples!

Really?

JavaScript Replace

var myNewString = myOldString.replace("something", "new thing");

placeholder = "<strong>Total Damage:</strong> $70,000.00".replace("$","£");

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744741673a4591063.html

相关推荐

  • How to change single char from string in JavaScript - Stack Overflow

    I have a variable which contains the following stringplaceholder = "<strong>Total Damage:<

    13小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信