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

tsunokawa

  • Junior Community Member
  • Posts: 4
  • 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: 2379
  • Hero Points: 314
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: 4
  • 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.