Return to Snippet

Revision: 10549
at January 3, 2009 16:21 by jdmays


Initial Code
/==============================
Check for empty string 
 string s = "hello";

  // Test if a string is neither null nor empty. This has to be a static
  // memeber of the String class because the object may be null!
  if ( !String.IsNullOrEmpty( s ) ) ...

  // Test if a string is empty.
  if ( s.Length != 0 ) ...

  // Test if a string is empty. (another way, more explicit way to do it)
  if ( s != String.Empty ) ...

Initial URL


Initial Description


Initial Title
Check for An Empty String

Initial Tags


Initial Language
C#