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 _
)
[C#]
public static bool HasText(
   string target
);

Parameters

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.

Remarks

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.

Example

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