Hi , I just trying to make calculator using string. I want to replace a specific text with another text. But when I try It replaces all text.
eg. DisplayString="2+3*9/"
while using replace function for the last letter("/") with Values("-").
output came like: DisplayString="2-3-9-"
what I want is: "2+3*9-"
SomeOne help me to fix this :)
why not you using simple replace to replace the / character.
Replace(DisplayString,"/","-")
because we don't know which is the last string .It may be either "+" or "-" or "/" or "*". we want to fetch last letter of string and replace with current symbols.
Hi Mohan,
Please use below expression -
Replace(DisplayString,Substr(DisplayString,Length(DisplayString)-1,Length(DisplayString)),"-")
Bit working but when we enter another operator for the second time it still remains same -it changes all the operators.
Don't understand what you you want to achieve. Could you please share OML?
yeah sure. check it out :)
above in question....
Could you please check attached oml.
I have changed if condition from DisplayString = NullIdentifier() to DisplayString = "".
Thanks
Vinod
You can use below function to replace last char of string. Here month = DisplayString
Replace(Month,Substr(Month,Length(Month)-1,Length(Month)),"*")
you can see last "/" replaced by "*"
yeah but we enter for second time it changes entire previous symbols .
could you please share sequence you output which you want after each iteration with an example. Like what is initial input, output after first iteration, output after second iteration.
I shared my oml check it out.