Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Functional Reactive Programming this week in the Other Languages 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: 65229
95
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