Share via


String.Substring Method (Int32, Int32)

Retrieves a substring from the current String object. The substring starts at a specified index number, or character position, in the String object and has a specified length.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

[MethodImplAttribute]
public string Substring (
         int startIndex,
         int length
)

Parameters

  • startIndex
    The starting index number in the substring.
  • length
    The number of characters in the substring

Return Value

A String object equivalent to the substring of the length specified in the length parameter, beginning at the starting index number in the current String object.

-or-

The Empty field if the startIndex parameter is equal to the length of the current object and length is 0 (zero).

Remarks

The startIndex parameter is zero-based.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

String Class
String Members
System Namespace