How to count the whitespace characters in a string in VB.NET

1 Answer

0 votes
Imports System
Imports System.Linq

Public Class CountWhitespaceCharactersInString_VB_NET
    Public Shared Sub Main(ByVal args As String())
		Dim s As String = "VB   (VB-NET) Programming     Language  "
		
        Dim WhiteSpaces As Integer = s.Count(AddressOf Char.IsWhiteSpace)
		
        Console.WriteLine("WhiteSpaces = {0}", WhiteSpaces)
    End Sub
End Class



' run:
'
' WhiteSpaces = 11
'

 



answered Nov 9, 2024 by avibootz

Related questions

...