Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

StringUtils.HasText Method

Checks if a String has text.

[Visual Basic]
Public Shared Sub HasText( _
   ByVal target As String _
public static bool HasText(
   string target


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

Return Value

true if the target is not a null reference (Nothing in Visual Basic), Length > zero (0), and does not consist solely of whitespace.


More specifically, returns true if the string is not a null reference (Nothing in Visual Basic), it's Length is > zero (0), and it has at least one non-whitespace character.


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

See Also

StringUtils Class | Spring.Util Namespace