Question: easy way to remove all specific substrings from one long string?

I could not find a function in StringTools package which removes all substrings (not single characters) from one long string directly. 

For example given a Latex string 

s:=" \\left \\int x \\,dx \\left";

And I want to remove all "\\left"  from it, which results in "  \\int x \\,dx "

In Mathematica, there is a function called StringDelete which removes all occurances of the substring in one call. Like this

s = " \\left \\int x \\,dx \\left";
StringDelete[s, "\\left"]

In Maple, I tried StringTools:-Remove(x->evalb(x="\\left"),s) and this did not work.Also tried

s:=" \\left \\int x \\,dx \\left";
StringTools:-Remove(x->StringTools:-Compare(x,"\\left"),s)

But this returned "leftintxdxleft"

And StringTools:-Delete needs a range, which one then has to first find.

I found this:

s:=" \\left \\int x \\,dx \\left";
idx:=[StringTools:-SearchAll("\\left",s)]; #returns index of first character in the string
StringTools:-Delete(s,idx[1]..idx[1]+4); #this only remove the first one. Need to loop to remove all.

Which returns the first substring. So one has to make a loop and keep removing all substrings found from the call to StringTools:-SearchAll

This is all too much work. But can be done.

The question is: What is the simplist way to remove all substrings from one string? All substrings are the same and the substrings can be more than one character.

Here is another example

s:="1234566X6Y67890A6BC66DEFGH";

And want to remove all "66" substrings, so the result will be

"12345X6Y67890A6BCDEFGH";

I am sure there must be an easier way to do this in Maple than having to call 2 or 3 functions and using a loop, but I could not find it so far. 

What would be the closest function in Maple to Mathematica's StringDelete? 

 

Please Wait...