SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: tsunokawa on November 13, 2019, 11:29:36 pm

Title: Replacing parts of a _str variable
Post by: tsunokawa 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.
Title: Re: Replacing parts of a _str variable
Post by: Graeme on November 14, 2019, 03:52:07 am
See the stranslate function.

Also help -> macro functions by category -> string functions.
Title: Re: Replacing parts of a _str variable
Post by: tsunokawa 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.