Can't use std.algorithm.remove on a char[]?
    ag0aep6g via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sun May  1 22:25:28 PDT 2016
    
    
  
On 02.05.2016 01:51, TheGag96 wrote:
> That's a shame. I'd really like to be able to remove a character from a
> character array... I supplier I just have to get used to casting to
> ubyte[] or maybe just using dchar[] instead.
Instead of casting you can also use `representation`[1] and 
`assumeUTF`[2] to convert to ubyte[] and back:
----
char[] thing = ['a', 'b', 'c'];
thing = thing.representation.remove(1).assumeUTF;
----
[1] https://dlang.org/phobos/std_string.html#.representation
[2] https://dlang.org/phobos/std_string.html#.assumeUTF
    
    
More information about the Digitalmars-d-learn
mailing list