Zebra0.com

csharp stringsStrings in C#

Strings in C#

Substr

The Substr method has either 1 or 2 arguments.
The first argument is the starting pos (counting from 0), the second is the number of characters.

If the second parameter is missing, it takes from the start pos to the end of the string

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

Ready?

Ready?

That's all! Congratulations on completing all of the lessons in csharp!