Checking if a string is null

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Jul 27 17:27:15 PDT 2007


Manfred Nowak wrote:
> Frits van Bommel wrote
> 
>> There's just some disagreement 
>> on what should be considered an "empty string"
> 
> If your secretary opens an envelope adressed to you, but the envelope 
> has not a single sheet of paper in it: what would you expect your 
> secretry to do?
>  
> 1) forward that envelope unmodified to you
> 
> 2) as above, but fill the envelope with an empty sheet of paper first
> 
> 3) something completely different

Sorry, I've never had a secretary. What would one do after opening a 
non-empty envelope?

One option you didn't mention would be to forward the contents and throw 
away the envelope itself. Since in the case of an empty envelope there 
are no contents to forward, it then degenerates to just throwing away 
the envelope...

Of course, if there's a return address or other writing on the envelope 
it might be handy to keep around. Like I said, I have no idea what 
exactly happens normally with envelopes secretaries open.

> After solving this for yourself, what would you do in the above case if 
> you are my secretary?

Depends on what I'd do with a non-empty envelope. However, one thing I 
would probably do in addition to that would be wonder why someone mailed 
an empty envelope in the first place ;).



About your analogy: If an empty envelope stands for an empty array, and 
null arrays are different from empty arrays (as one group of posters 
would prefer) then what would be the equivalent of a null array? No 
envelope at all? A postcard with "This is not an envelope" written on it 
perhaps? ;)



More information about the Digitalmars-d mailing list