Re: How to erase chars from char[]?

2010-06-21 Thread Andrei Alexandrescu
On 06/21/2010 06:43 AM, Ben Hanson wrote: I've changed the code to use CharT[] again, which simplified things substantially. However, I can't find a way to erase characters from a char[]. Can anyone help? http://www.digitalmars.com/d/2.0/phobos/std_array.html#replace Andrei

Re: How to erase chars from char[]?

2010-06-21 Thread bearophile
Ben Hanson: > However, I can't find a way to erase characters from a char[]. > Can anyone help? If you need to delete the last chars you can just decrease the length. If you need to delete chars in the middle you can copy items with memmove() and then decrease the length. You can also write a fu

How to erase chars from char[]?

2010-06-21 Thread Ben Hanson
I've changed the code to use CharT[] again, which simplified things substantially. However, I can't find a way to erase characters from a char[]. Can anyone help? See the current code below. Thanks, Ben module main; import std.algorithm; import std.string; template regex(CharT) { struct basic