Mono Class Library: System.String Overview | Members

System.String.Insert Method

Returns a string equivalent to the current instance with a specified string inserted at the specified position. [Edit]

public string Insert (int startIndex, string value)

Parameters

startIndex
A int containing the index of the insertion. [Edit]
value
The string to insert. [Edit]

Returns

A new string that is equivalent to the current string with value inserted at index startIndex. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionvalue is a null reference. [Edit]
ArgumentOutOfRangeExceptionstartIndex is greater than the length of the current instance. [Edit]

Remarks

In the new string returned by this method, the first character of value is at startIndex, and all characters in the current string from startIndex to the end are inserted in the new string after the last character of value. [Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0