1

i want to replace 2 string by 2 values in some time. when i do this.

date1="Date (1995,12,17)"
this.formControlValue=this.formControlValue.replace(/\$RepStartDate/i,date1)

it work perfectly. but when i do this:

this.formControlValue=this.formControlValue.replace(/\$RepStartDate/i,date1)
this.formControlValue=this.formControlValue.replace(/\$RepEndDate/i,date2)

just the first string is replaced,the other string is not converted. how can i replace 2 string in some time?

1

1 Answer 1

1

easily:

this.formControlValue=this.formControlValue.replace(/\$RepStartDate/i,date1)
.replace(/\$RepEndDate/i,date2)

replace() return string you can replace it again.

Sign up to request clarification or add additional context in comments.

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.