AllTheTimeWorld.com

csharp stringsString Substr

String Substr

Substr extracts a portion of a string

String Substr

Substr extracts a portion of a string

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?