asp.net.ph

String.Insert Method

System Namespace   String Class


Inserts a specified instance of String at a specified index position in the given String.

[ VB ]
<Serializable>
Public Function Insert ( _
   ByVal startIndex As Integer, _
   ByVal value As String _
) As String

[ C# ]
[ Serializable ]
public string Insert (
   int startIndex,
   string value
);

[ C++ ]
[ Serializable ]
public: String* Insert (
   int startIndex,
   String* value
);

[ JScript ]
public Serializable
function Insert (
   startIndex : int,
   value : String
) : String;

Parameters

startIndex
The index position of the insertion.
value
The String to insert.

Return Value

A new String equivalent to this instance but with value inserted at position startIndex.

Exceptions


Exception Type Condition
ArgumentNullException value is a null reference ( Nothing in Visual Basic ).
ArgumentOutOfRangeException startIndex is negative or greater than the length of this instance.

Remarks

If startIndex is equal to the length of this instance, value is appended to the end of this instance.

For example, the return value of "abc".Insert ( 2, "XYZ" ) is "abXYZc".

See Also

String Members   Int32   Concat   CopyTo   Insert   Join   Remove   Replace   Split   Substring   Trim Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph