You can pad an integer with leading zeros by using the “D” string format specifier. You can pad integer, floating-point and negative numbers with leading zeros by using a “D” format string. Continue reading “Pad the value with leading zero using D format specifier in C#”
Tag: Strings in C#
Check whether a string is null, empty, or only contains the white-space characters
If you are working with the .Net framework 4.5, you can use the String.IsNullOrWhiteSpace Method to specify the string is null, empty, or consists only of white-space characters.
The following example contains the five string type variables, we pass the each variable into the IsNullOrWhiteSpace method to check whether a string is null, empty, or only contains the white-space characters. Continue reading “Check whether a string is null, empty, or only contains the white-space characters”