What is the recommended way to remove a space from char [] in D. for example using dmd 2.057 I have
import std.stdio; import std.string; import std.algorithm; char[] line; int main(){ line = r"this is a line with spaces "; line = removechars(line," "); writeln(line); return 0; }
When compiling, this will result in this error:
Error: cannot implicitly convert expression ("this is a line with spaces ") of type string to char[] Error: template std.string.removechars(S) if (isSomeString!(S)) does not match any function template declaration Error: template std.string.removechars(S) if (isSomeString!(S)) cannot deduce template function from argument types !()(char[],string)
When I performed any search on Google, I found that a similar error was registered as an error and was sent in June 2011, but I'm not sure if this was a link to the same or to another problem.
In general, what approach is recommended to remove from the string and indicate the order of characters from the previous character array?
In this case, return
assert(line == "thisisalinewithspaces")
after removing whitespace
source share