Zebra0.com

csharp strings

length

Length gives the number of characters in the String, including spaces, punctuation, and any other characters.

private void btnOK_Click(object sender, EventArgs e)
{
   String s = txtInput.Text;
   lblOutput.Text = "Length="+s.Length;
}

Ready?

Ready?

End of lesson, Next lesson: Files in C#