Navigation:  thinBasic Modules > Core > String handling >

REMOVE$

Previous pageReturn to chapter overviewNext page

 

Description

 

Return a copy of a string with characters or strings removed.

 

Syntax

 

s = REMOVE$(MainString, [ANY] MatchString)

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

MainString

String

No

The string expression from which to remove characters

MatchString

String

No

The string expression to remove all occurrences of.  If MatchString is not present in MainString, all of MainString is returned intact.

If the ANY keyword is included, MatchString specifies a list of single characters to be searched for individually, a match on any one of which will cause that character to be removed from the result.

 

Remarks

 

Restrictions

 

See also

 

String Handling,

 

Examples

 

Thanks to Abraxas for the following script example

 

Dim sMainString        As String VALUE "HELLO WORLD"

Dim sMatchString       As String VALUE "LO"

Dim sStringExpression  As String VALUE "ThinBasic "

Dim sNewString         As String VALUE "R"

Dim sREP   As String

Dim sREM   As String

Dim sRPL   As String

Dim Count  As DWORD VALUE 10

Dim sMsg   As String

 

sREP = REPEAT$(Count, sStringExpression)

sREM = REMOVE$(sMainString,sMatchString)

sRPL = REPLACE$(sMainString, Any sMatchString, With sNewString)

 

sMsg += "sMainString = " & sMainString & $CRLF

sMsg += "sMatchString = " & sMatchString & $CRLF

sMsg += "sStringExpression = " & sStringExpression & $CRLF

sMSG += "Count = " & Count & $CRLF & $CRLF

sMsg += "REPEAT$(Count, StringExpression) = " & sREP & $CRLF & $CRLF

sMsg += "REMOVE$(sMainString,sMatchString) = " & sREM & $CRLF & $CRLF

sMsg += "REPLACE$(sMainString, [ANY] sMatchString, [WITH] sNewString) = " & sRPL & $CRLF & $CRLF

 

MSGBOX 0, sMsg

 

 

 

 

© 2004-2008 thinBasic. All rights reserved. Version 1.7.0.0 Web Site: http://www.thinbasic.com