HI Everyone,
I have one sample string below,
str formula = "A+0.3*B+AC";
Now I want to replace character A first with some value and then AC with some Value.
I am trying to build formula. Please suggest how can I achieve this?
If I use strReplace my formula gets modified as below
modFormula = strReplace(formula, "A", "15");
modFormula = 15+0.3*B+15C
It not only replaces first A but also A from AC.
Is there any solution?
Hi Rhushikesh Raut,
You could also try
modFormula = strReplace(formula, "A+", "15+");
The easiest option is replacing AC string first and only then replacing A.
Hi Rhushikesh,
You can try two functions for this -
1. strFind() to find the first position of A.
2. strPoke to replace A with the value.
Please check here for examples.
Martin Dráb
456
Most Valuable Professional
Abhilash Warrier
310
Saalim Ansari
261