Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove substring from string in D

Tags:

d

phobos

How to remove all occurrences of a string in another? I can do this using the following code:

std.array.replace: "the string".replace("the", "")

But I wonder if there is a dedicated function for this in phobos?

like image 952
Denis Gladkiy Avatar asked Mar 14 '23 14:03

Denis Gladkiy


1 Answers

Yes. It's correct function. But you might want to use it from std.string. Because if in future version something changes you'll still be using correct function.

From documentation of std.string:

The following functions are publicly imported:

std.array: replace replaceInPlace ...

like image 149
sigod Avatar answered Mar 24 '23 23:03

sigod