stringlib::remove

Delete substrings

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

stringlib::remove(string1, string2, <First>)

Description

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

After 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.

Examples

Example 1

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

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

Example 2

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

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

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")

Parameters

string1, string2

Non empty string

Options

First

Determines that only the first appearance of string2 in string1 will be deleted

Return Values

Given string without the deleted parts

See Also

MuPAD Functions

Was this topic helpful?