Author Topic: Replacing parts of a _str variable  (Read 3559 times)

tsunokawa

  • Junior Community Member
  • Posts: 7
  • Hero Points: 0
Replacing parts of a _str variable
« on: November 13, 2019, 11:29:36 PM »
Hello

How do I replace specific strings in a _str variable with another string.
Here is an example describing what I want to do.

_str before = "ABC";
_str searched = "B";
_str replacedWith = "D";
_str after;
after = xxxxx(before, searched, replacedWith); // after = "ADC"

Is there any way to do this? It would be nice if I can use regular expression for "searched" string above.
Thank you.

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Replacing parts of a _str variable
« Reply #1 on: November 14, 2019, 03:52:07 AM »
See the stranslate function.

Also help -> macro functions by category -> string functions.

tsunokawa

  • Junior Community Member
  • Posts: 7
  • Hero Points: 0
Re: Replacing parts of a _str variable
« Reply #2 on: November 14, 2019, 02:14:40 PM »
Thank you very much, Graeme.
That is just what I searched for. And it worked well.
Thank you again.