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

Last Reply 10 months ago By pandeyism

Posted 10 months 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 10 months ago Modified on 10 months ago

 string s="The Quick Brown";

Total Characters Count :s.length();


use string builder class in namespace of page

Posted 10 months 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