Code to check the existence of white spaces or null in a string

Madhu.b.rokkam
Posted by Madhu.b.rokkam under C# category on | Points: 40 | Views : 2891
In 4.0 we have IsNullOrWhiteSpace to check string contains nothing but whitespace

string yourString = "     ";
Console.WriteLine(String.IsNullOrWhiteSpace(yourString));


Output
True

string yourString = null;
Console.WriteLine(String.IsNullOrWhiteSpace(yourString));


Output
True

Comments or Responses

Login to post response