Help Center

AfxStrRemovefunction

Returns a new string with substrings removed. Case sensitive.

String ManagementfunctionAfxStr.incdocumented

Syntax

FUNCTION AfxStrRemove (BYREF wszMainStr AS CONST WSTRING, BYREF wszMatchStr AS CONST WSTRING) AS DWSTRING
FUNCTION AfxStrRemove (BYREF wszMainStr AS CONST WSTRING, BYREF wszDelim1 AS CONST WSTRING, BYREF wszDelim2 AS CONST WSTRING, BYVAL fRemoveAll AS BOOLEAN = FALSE) AS DWSTRING
FUNCTION AfxStrRemove (BYVAL nStart AS LONG = 1, BYREF wszMainStr AS CONST WSTRING, BYREF wszDelim1 AS CONST WSTRING, BYREF wszDelim2 AS CONST WSTRING, BYVAL fRemoveAll AS BOOLEAN = FALSE) AS DWSTRING

Parameters

NameDescription
wszMainStrThe main string.
wszMatchStrThe string expression to be removed. If wszMatchStr is not present in wszMainStr, all of wszMainStr is returned intact.
wszMainStrThe main string.
wszDelim1The first delimiter
wszDelim2The second delimiter
fRemoveAllRecursively remove all the occurrences.
nStartOptional. The one-based starting position where to start the search.
wszMainStrThe main string.
wszDelim1The first delimiter
wszDelim2The second delimiter
fRemoveAllRecursively remove all the occurrences.

Description

Returns a new string with strings removed. Case sensitive.

Examples

DIM dws AS DWSTRING = AfxStrRemove("Hello World. Welcome to the Freebasic World", "World")

DIM dwsText AS DWSTRING = "blah blah (text between parentheses) blah blah" DIM dws AS DWSTRING = AfxStrRemove(dwsText, "(", ")") ' Returns "blah blah blah blah"

DIM dwsText AS DWSTRING = "As Long var1(34), var2( 73 ), var3(any)" DIM dws AS DWSTRING = AfxStrRemove(dwsText, "(", ")", TRUE) ' Returns "As Long var1, var2, var3"

DIM dwsText AS DWSTRING = "blah blah (text beween parentheses) blah blah" DIM dws AS DWSTRING = AfxStrRemove(dwsText, "(", ")") ' Returns "blah blah blah blah"

Reference

  • Include file AfxStr.inc
  • Defined in AfxNova/AfxStr.inc:186
  • Documented in String Management/String Procedures.md
  • Topic: String Procedures