Gary Willoughby:

What is the correct way to test for an empty string?

I've used

if (string == "")

and

if (string is null)

and both (O_o) in some places, it's starting to do my head in. What is the correct way?

The right, safe and readable way is to use std.array.empty:

if (myString.empty)

If you don't want to import functions, then test for the length:

if (string.length == 0)

Bye,
bearophile

Reply via email to