How to remove whitespace from a string
Paul Backus
snarwin at gmail.com
Thu Jan 16 14:54:38 UTC 2020
On Thursday, 16 January 2020 at 13:36:10 UTC, Namal wrote:
> Hello, what is the way to remove whitespace from a string (not
> only at the beginning and end)..
import std.algorithm: filter;
import std.uni: isWhite;
import std.stdio: writeln;
void main()
{
string s = " hello world ! ";
writeln(s.filter!(c => !c.isWhite));
// prints: helloworld!
}
More information about the Digitalmars-d-learn
mailing list