How to count the number of characters in a string without spaces and special characters in VB.NET

1 Answer

0 votes
Imports System
Imports System.Text.RegularExpressions

Public Class CountCharactersInStringWithoutSpacesAndSpecialCharacters_VB_NET
	Public Shared Sub Main()
		Dim str As String = "8vb.net rust, java 123 c &c++."
		
        Dim result As Integer = Regex.Replace(str, "[^A-Za-z]", "").Length
		
        Console.WriteLine(result)
    End Sub
End Class


' run:
'
' 15
'

 



answered Sep 15, 2024 by avibootz
...