Real simple question... for good programmers
Enjoys Math
enjoysmath at gmail.com
Sat Oct 22 22:01:09 UTC 2022
On Saturday, 22 October 2022 at 21:53:05 UTC, WhatMeWorry wrote:
>
>
> string[] tokens = userSID.output.split!isWhite;
> writeln("tokens = ", tokens);
>
> tokens = ["SID", "", "", "", "", "", "", "", "", "", "", "",
> "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
> "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
> "", "", "", "",
> "S-1-5-21-3823976785-3597194045-4221507747-1779", "", "", "",
> "", "", "", "", ""]
>
>
> Is there a clever way that I can discard all the extra null
> strings in the resultant string array?
>
> I've been playing with isControl, whitespace, etc. Ready to rip
> my hair out.
>
Why not `strip`? Works on ranges:
https://dlang.org/phobos/std_algorithm_mutation.html#.strip
More information about the Digitalmars-d-learn
mailing list