string class : Insert(int,string) method

Description

Gets a new string which a specified string is inserted at a specified position in this instance.

Syntax

stringInstance.Insert(int insertPosition ,string insertString)

Arguments

ClassNameDescription
intinsertPositionA insert position.
stringinsertStringA insert string.

Return value

ClassDescription
stringA new string which a specified string is inserted at a specified position in this instance.

Sample code

//anyString is a instance of string type.

string newString = anyString.Insert(5, "ww");

Notes

It's a wrapper of the System.String.Insert(Int32, String).

The index is zero-based.

Links for reference

Copyright © Rice All rights reserved.