How to count the number of spaces in a string with VB.NET

1 Answer

0 votes
Imports System

Public Class Program
	Public  Shared Sub Main()
        Dim s As String = "c # . n e t"
		
        Dim spaceCount As Integer = s.Split(" ").Length - 1
		
        Console.WriteLine(spaceCount)
    End Sub
End Class





' run:
'
' 5
'

 



answered Sep 28, 2021 by avibootz

Related questions

2 answers 107 views
1 answer 103 views
1 answer 139 views
1 answer 160 views
...