These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

replace string function

vinsanity
Registered: Apr 12 2010
Posts: 5

Hi,

Right now, I'm trying to use the replace String function with my form but for some reason, I'm not getting the result that I desire.

For example, here is my code below

form1.variables.x.value = "ABAA";

form1.variables.x.value = String.replace(form1.variables.x.value,'A','x');

AMLSummary.rawValue = form1.variables.x.value;

When I output AMLSummarY (which is a textfield), the answer I'm expecting to be is "xBxx".

However, the result I'm getting is "xBAA".

Does anyone know why? Much appreciated. Vince

try67
Expert
Registered: Oct 30 2008
Posts: 2398
It looks like the replace function is not set to work globally, therefore only the first match is replaced.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com