Zebra0.com

csharp strings

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?

End of lesson, Next lesson: Files in C#