Replacing string characters
Posted: Thu Mar 10, 2022 3:07 pm
Dear friends, I am writing to ask you for help in solving the following problem. I have the following string representing my variables
e = "HPG = C(1) + C(2)*EPUTI + C(3)*INCGM + C(4)*LMSIM + C(5)*HPGM(-1) + C(7)*LMSIM(-1) + C(8)*INCGM(-1)"
that I would like to transform as follows
e = "HPG c EPUTI INCGM LMSIM EPUTI*HPGM(-1) EPUTI*INCGM EPUTI*INCGM(-1) EPUTI*LMSM EPUTI*LMSIM(-1)".
It is important that the variables appear in the exact order above. I used a combination of "@replace" commands but was unable to get the desired result. I hope some of you can kindly help me.
Regards,
Wiz
e = "HPG = C(1) + C(2)*EPUTI + C(3)*INCGM + C(4)*LMSIM + C(5)*HPGM(-1) + C(7)*LMSIM(-1) + C(8)*INCGM(-1)"
that I would like to transform as follows
e = "HPG c EPUTI INCGM LMSIM EPUTI*HPGM(-1) EPUTI*INCGM EPUTI*INCGM(-1) EPUTI*LMSM EPUTI*LMSIM(-1)".
It is important that the variables appear in the exact order above. I used a combination of "@replace" commands but was unable to get the desired result. I hope some of you can kindly help me.
Regards,
Wiz