Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

StringUtils.IsNullOrEmpty Method

Checks if a String is a null reference (Nothing in Visual Basic) or an empty string.

[Visual Basic]
Public Shared Sub IsNullOrEmpty( _
   ByVal target As String _
)
[C#]
public static bool IsNullOrEmpty(
   string target
);

Parameters

target
The string to check, may (obviously) be a null reference (Nothing in Visual Basic).

Return Value

true if the target is a null reference (Nothing in Visual Basic), has a length equal to zero (0), or is composed entirely of whitespace characters.

Remarks

More specifically, returns false if the string is a null reference (Nothing in Visual Basic), it's Length is equal to zero (0), or it is composed entirely of whitespace characters.

Example

StringUtils.IsNullOrEmpty(null) = true
StringUtils.IsNullOrEmpty("") = true
StringUtils.IsNullOrEmpty(" ") = true
StringUtils.IsNullOrEmpty("12345") = false
StringUtils.IsNullOrEmpty(" 12345 ") = false

See Also

StringUtils Class | Spring.Util Namespace