InsertString

From NWN Lexicon

Contents

[edit] InsertString(string, string, int)

This function will insert a string into the destination string at the position indicated by nPosition.

string InsertString(
    string sDestination,
    string sString,
    int nPosition
);

[edit] Parameters

sDestination

String to insert into.

sString

String to insert.

nPosition

Index position to insert at.

[edit] Description

This function inserts a string into another string.

[edit] Remarks

Prior to version 1.26 this function would instead overwrite vice insert.

[edit] Known Bugs

This function fails to add sString at the end of the sDestination and returns sDestination only. See example 2.

[edit] Version

1.26

[edit] Example

string s1 = "Bacon and spam";
string s2 = ", ham";
string s3 = InsertString(s1, s2, 5);
//s3 = "Bacon, ham and spam"
string s1 = "foo";
string s2 = "bar";
string s3 = InsertString(s1, s2, 3);
//s3 = "foo"

[edit] See Also


 author: Michael Nork, editors: Charles Feduke, Mistress, additional contributors: Iceberg, Fireboar
 

Personal tools
Categories