Syntax For String Replacement In an Aqua Script Open APIs

by Nov 4, 2012

What’s the syntax to do a string replace? If I want to take a string variable with the value “DOCTOR JONES” and replace “DOCTOR” with “DR”, what’s the right syntax for that?

Response

Niels Gron over 10 years ago
Return a string where “DOCTOR” is replaced with “AquaFold”:

var str=”Visit DOCTOR!”;
var n=str.replace(“DOCTOR”,”AquaFold”);
The result of n will be:

Visit AquaFold!

Aaron Wevodau over 10 years ago
Thanks! Much obliged.