REMOVE$ function

Purpose:

REMOVE$ returns a substring of MainStr parameter with all case-sensitive occurrences of the Match string being removed.

Syntax:

NewStr = REMOVE$(MainStr AS STRING, Match AS STRING)

Return Value:

  • Data type: STRING
    NewStr Substring of MainStr with all occurrences of the Match string removed.

Parameters:

  • Data type: STRING
    MainStr String to be searched and purged of Match character.
  • Data type: STRING
    Match All occurrences of this string are to be removed from MainStr.

Example:

DIM NewStr$

NewStr$ = REMOVE$("123ABC123", "123")

PRINT NewStr$

Result:

ABC

BCX Console Sample Programs using the REMOVE$ function.

REMOVE statement

Purpose:

REMOVE deletes all all occurrences of the Match string from MainStr.

Syntax:

REMOVE Match AS STRING FROM MainStr AS STRING

Parameters:

  • Data type: STRING
    MainStr String to be searched and purged of Match character.
  • Data type: STRING
    Match All occurrences of this string are to be removed from MainStr.

Remarks:

The REMOVE command also allows full expressions and arrays as arguments.

Example:

DIM MainStr$

MainStr$ = "   123ABC123    "

REMOVE UCASE$("abc") FROM LTRIM$(RTRIM$(MainStr$))

PRINT MainStr$

Result:

123123

BCX Console Sample Programs using the REMOVE statement.

IREMOVE$ function

Purpose:

IREMOVE$ returns a substring of MainStr with all case-insensitive occurrences of Match removed.

Syntax 1:

NewStr = IREMOVE$(MainStr AS STRING, Match AS STRING))

Return Value:

  • Data type: STRING
    NewStr Substring of MainStr with all case insensitive occurrences of Match removed.

Parameters:

  • Data type: STRING
    MainStr String to be searched for and purged of Match string.
  • Data type: STRING
    Match All occurrences of this string are to be removed without regard to case sensitivity in MainStr. ABC, abc, Abc, aBc and so on are all considered equivalent.

IREMOVE statement

Purpose:

IREMOVE performs an in-place, case-insensitive, removal of all of the Match substrings contained in MainStr.

Syntax:

IREMOVE Match AS STRING FROM MainStrMatch AS STRING)

Parameters:

  • Data type: STRING
    MainStr String to be searched for and purged of Match string.
  • Data type: STRING
    Match All case insensitive occurrences of this string are to be removed from MainStr. ABC, abc, Abc, aBc and so on are all considered equivalent.

Example:

DIM A$

A$ = "This is A saMpLe oF a LONG, long, LOng, loNG, rambling sentence."

IREMOVE "long, " FROM A$ 'now we can remove them all
IREPLACE CHR$(32,32) WITH CHR$(32) IN A$
IREPLACE "A SAMPLE OF" WITH "not" IN A$
PRINT A$ ' Result: This is not a rambling sentence.

Result:

This is not a rambling sentence.

REMOVEANY$ function

Purpose:

REMOVEANY$ returns a substring of MainStr parameter with all occurrences of characters contained in the Match string removed.

Syntax:

NewStr = REMOVEANY$(MainStr AS STRING, _
                      Match AS STRING)

Return Value:

  • Data type: STRING
    NewStr Substring of MainStr with all occurrences of characters contained in the Match string removed.

Parameters:

  • Data type: STRING
    MainStr String to be searched and purged of all Match characters.
  • Data type: STRING
    Match All occurrences of characters in this string are to be removed from MainStr.

Example:

PRINT             "123AbC456DeF789"
PRINT REMOVEANY$ ("123AbC456DeF789", "abcdef") ' case sensitive (default) 
                
PAUSE

Result:

123AbC456DeF789
123AC456DF789

Press any key to continue . . .

IREMOVEANY$ function

Purpose:

IREMOVEANY$ returns a substring of MainStr parameter with all case-insensitive, occurrences of characters contained in the Match string removed.

Syntax:

NewStr = IREMOVEANY$(MainStr AS STRING, _
                       Match AS STRING)

Return Value:

  • Data type: STRING
    NewStr Substring of MainStr with all occurrences of characters contained in the Match string removed.

Parameters:

  • Data type: STRING
    MainStr String to be searched and purged of all Match characters.
  • Data type: STRING
    Match All occurrences of characters in this string are to be removed from MainStr.

Example:

PRINT             "123AbC456DeF789"
PRINT IREMOVEANY$("123AbC456DeF789", "abcdef") ' case insensitive 
                
PAUSE

Result:

123AbC456DeF789
123456789

Press any key to continue . . .