I have a string which looks like this: (id:561644cdb40fbe0100247dd7:q) (id:56165d8a79c8c40100adbdb6:q) and I need to replace the different id's with different values. I already have the id's in a variable and trying to loop through with something like this var mailId = "(id:" + rplcId + ":q)"; But If I use the replace() function it doesnt work...Any other suggestions?
-
4Show what you have coded, what progress you made and what error you got, instead of just saying "doesn't work".Passerby– Passerby2015年10月15日 08:37:31 +00:00Commented Oct 15, 2015 at 8:37
2 Answers 2
You can select the id with:
"(id:56165d8a79c8c40100adbdb6:q)".split(":")[1]
answered Oct 15, 2015 at 8:37
javifm
7054 gold badges9 silver badges22 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
var id = "(id:561644cdb40fbe0100247dd7:q)";
var idArr = id.split(":");
idArr[1] = newId; //56165d8a79c8c40100adbdb6
var mailId = idArr[0]+idArr[1]+idArr[2];
and please provide your full code
answered Oct 15, 2015 at 8:40
Joseph Khella
7152 gold badges9 silver badges26 bronze badges
Comments
lang-js