## `stringlib::remove` -- Delete substrings

#### Introduction

With `stringlib::remove` a substring can be deleted from another string.

#### Call(s)

`stringlib::remove(string1, string2 <, option>)`

#### Parameters

`string1, string2` | - | non empty string

#### Options

`First` | - | determines that only the first appearance of `string2` in `string1` will be deleted

#### Returns

the given string without the deleted parts

#### Related Functions

`delete`, `stringlib::subs`, `stringlib::subsop`

#### Details

- After a `string2` has been found, the search for further occurrences of it continues after its last letter; hence only the first of several overlapping occurrences is detected. See Example 3.

#### Example 1

By default, out of several occurrences of the given substring all are removed.

    >> stringlib::remove("abcdeabcdeabcde", "bc")

                                    "adeadeade"

#### Example 2

Using the option `First` causes `stringlib::remove` to remove only the first occurrence of the given substring.

    >> stringlib::remove("abcdeabcdeabcde", "bc", First)

                                  "adeabcdeabcde"

#### Example 3

In the following example, the given substring occurs twice, where both instances of it do overlap. Only the first occurrence is removed.

    >> stringlib::remove("aaa", "aa")

                                        "a"

#### Changes

- used to be called `string::delete`

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000