Previous Page Next Page Contents

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

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




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000