Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to replace string using JS ?

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to replace string using JS ?

for example,
var d="iss.classArr[0].components[0].c[1].data";
d.replace("c[1]", "c[0]"); // fail

I try to replace index of c. I want to get "iss.classArr[0].components[0].c[0].data".

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked the APi for the String class?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic