Does D have an equivalent to C#'s String.IsNullOrWhiteSpace?

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Thu Oct 12 19:06:00 UTC 2017


On Thursday, 12 October 2017 at 18:17:54 UTC, Adam D. Ruppe wrote:
> On Thursday, 12 October 2017 at 18:11:55 UTC, Nieto wrote:
>> Does D have an equivalent to C#'s String.IsNullOrWhiteSpace() 
>> in the standard library?
>
> import std.string;
>
> if(str.strip().length == 0) {
>   // is null, empty, or all whitespace
> }

Also

    if(str.strip().empty)

std.array.empty() works essentially the same as IsNullOrEmpty()


More information about the Digitalmars-d-learn mailing list