Find Length / Count Number of characters in sentence (String) using C# and VB.Net

Last Reply one year ago By pandeyism

Posted one year ago

The Quick brown fox jumps over the lazy dog.

I want to count character length till "The Quick Brown"  and then want to print output like this

Total Characters Count : 15

how to do it in

Posted one year ago Modified on one year ago

 string s="The Quick Brown";

Total Characters Count :s.length();


use string builder class in namespace of page

Posted one year ago

Hi smile,

Please take reference to below code and correct your code.


<asp:Label ID="lblStatement" runat="server"></asp:Label>



protected void Page_Load(object sender, EventArgs e)
    string strStatement = "The Quick Brown";
    lblStatement.Text = "Total Characters Count : " + strStatement.Length.ToString();


Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    Dim strStatement As String = "The Quick Brown"
    lblStatement.Text = "Total Characters Count : " & strStatement.Length.ToString()
End Sub


Total Characters Count : 15