Home » 2012 » September » 25

Archive for September 25, 2012

Count number of charcters in a string – VB.NET

Code Behind Dim count As Integer = 0 Dim CharCount As String = “Today is sunny day” For Each c As Char In CharCount If Char.IsLetter(c) Or Char.IsNumber(c) Then count += 1 End If Next LblCharCount.Text = “Total number of characters is “& count.ToString() Markup Page <asp:Label ID=”LblCharCount” runat=”server” /></asp:Label>