2

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?

1
  • 4
    Show what you have coded, what progress you made and what error you got, instead of just saying "doesn't work". Commented Oct 15, 2015 at 8:37

2 Answers 2

1

You can select the id with:

"(id:56165d8a79c8c40100adbdb6:q)".split(":")[1]
Sign up to request clarification or add additional context in comments.

Comments

1
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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.