Replace text for a specific position

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.


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 -


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....

Hi Mohan,

Could you please check attached oml.

I have changed if condition from DisplayString =  NullIdentifier() to  DisplayString = "".




You can use below function to replace last char of string. Here month = DisplayString


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.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.