# llInsertString

*LSL function*

```lsl
string string llInsertString(string dst, integer index, string src);
```

- `string dst`: Target destination string.
- `integer index`: Codepoint index where insertion starts.
- `string src`: Source string to insert.

- Returns: `string`
- Energy: 10

i.e. unlike other somewhat similar string functions such as [llGetSubString](/functions/llGetSubString/) and [llDeleteSubString](/functions/llDeleteSubString/), you cannot use -1 for the counting with this function. You may use instead the function provided a bit further below.

```lsl title="How to use" frame="terminal"
string result = llInsertString("", 0, "");
```

## Examples

<details open>
<summary>Example 1</summary>

```lsl
llInsertString("input", 2, "put out")// returns "input output"
```

</details>

## See also

### Functions

- [llDeleteSubString](/functions/llDeleteSubString/)
- [llGetSubString](/functions/llGetSubString/)
- [llReplaceSubString](/functions/llReplaceSubString/)

### Articles

- [Examples:](https://wiki.secondlife.com/wiki/Category:LSL_Examples) [str_replace](https://wiki.secondlife.com/wiki/Library_Combined_Library#str-replace) — Replace all instances of a string with another string in a target string
- [Examples:](https://wiki.secondlife.com/wiki/Category:LSL_Examples) [SplitLine](https://wiki.secondlife.com/wiki/SplitLine) — Insert 'new line' escape codes at certain positions of a string

---

*Source: [LlInsertString](https://wiki.secondlife.com/wiki/LlInsertString) on the Second Life Wiki. Content from the Second Life Wiki articles LlInsertString (revision 1213090, 2023-01-30) and Template:LSL Function/negative index (revision 1200041, 2016-05-02), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llInsertString/
