StringExtensionsCountWords Method
Counts the number of words in the input string.
Namespace: DevCase.Extensions.StringExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static int CountWords(
this string input,
char wordSeparator = ''
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function CountWords (
input As String,
Optional wordSeparator As Char = ""C
) As Integer
Dim input As String
Dim wordSeparator As Char
Dim returnValue As Integer
returnValue = input.CountWords(wordSeparator)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
static int CountWords(
String^ input,
wchar_t wordSeparator = L''
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member CountWords :
input : string *
?wordSeparator : char
(* Defaults:
let _wordSeparator = defaultArg wordSeparator ''
*)
-> int
No code example is currently available or this language may not be supported.
- input String
-
The input string to count words from.
- wordSeparator Char (Optional)
-
The character used to separate words (default is a space).
Int32
The number of words in the input string.
In Visual Basic and C#, you can call this method as an instance method on any object of type
String. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This is a code example.
No code example is currently available or this language may not be supported.
Dim input As String = "Life_is_like_a_box_of_chocolates._You_never_know_what_you're_gonna_get."
Dim wordSeparator As Char = "_"c
Dim result As String = CountWords(input, wordSeparator)
Console.WriteLine(result)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.