Hi All,
I had written a piece of code previosly
String uniqueFormula = tempFormula[0]; String[] tempMapVars = tempFormula[1].split("\\s*;\\s*"); System.out.println(tempMapVars.length); for (int i=0; i< tempMapVars.length; i++){ String[] keyValue = tempMapVars[i].split("\\s*=\\s*",2); if (keyValue.length==2){ StringBuffer sb = new StringBuffer(keyValue[0]); sb.append("_").append(runNo++); uniqueFormula = uniqueFormula.replace(keyValue[0],sb.toString()); var2MeasParaHM.put(new String(sb.toString()), new String(keyValue[1])); } }
The content of Unique Formula is as given below initially.
The idea behind code is to append a unique number along with v1,v2,v3 and so on to make it unique.(if(V1>2.0E-8&&V1<2.0E-7&&V2>2.0E-8&&V2<2.0E-7&&V3>2.0E-8&&V3<2.0E-7&&V4>2.0E-8&&V4<2.0E-7&&V5>2.0E-8&&V5<2.0E-7&&V6>2.0E-8&&V6<2.0E-7&&V7>2.0E-8&&V7<2.0E-7&&V8>2.0E-8&&V8<2.0E-7&&V9>2.0E-8&&V9<2.0E-7&&V10>2.0E-8&&V10<2.0E-7,output=1.0,output=0.0))*1
so after running the piece of code the UniqyeFormula Becomes like this
The issue i face in when Parameter becomes in Double Digit. V1 becomes V1_0 which is correct But V10 Becomes V1_00 which is not correct.(if(V1_0>2.0E-8&&V1_0<2.0E-7&&V2_1>2.0E-8&&V2_1<2.0E-7&&V3_2>2.0E-8&&V3_2<2.0E-7&&V4_3>2.0E-8&&V4_3<2.0E-7&&V5_4>2.0E-8&&V5_4<2.0E-7&&V6_5>2.0E-8&&V6_5<2.0E-7&&V7_6>2.0E-8&&V7_6<2.0E-7&&V8_7>2.0E-8&&V8_7<2.0E-7&&V9_8>2.0E-8&&V9_8<2.0E-7&&V1_00>2.0E-8&&V1_00<2.0E-7,output=1.0,output=0.0))*1
uniqueFormula = uniqueFormula.replace(keyValue[0],sb.toString());
This piece of line V1 with V1_0.....but its also searching for V10 and splits it as V1_00.
Can anyone Suggest how to overcome this issue.
Regards
Ashesh