StringDelete

StringDelete["string",patt]

yields the string obtained by deleting from string all occurrences of anything matching the string pattern patt.

StringDelete[patt]

represents an operator form of StringDelete that can be applied to an expression.

Details and Options

  • The string expression patt can contain any of the objects specified in the notes for StringExpression.
  • Setting the option IgnoreCase->True makes StringDelete treat lowercase and uppercase letters as equivalent.
  • StringDelete[patt][expr] is equivalent to StringDelete[expr,patt].
  • StringDelete[BioSequence["type","seq"],patt] removes cases of patt in the string "seq" yielding a biomolecular sequence. In this case, degenerate letters in patt are interpreted as wildcard patterns based on the type of biomolecular sequence. Use Verbatim["patt"] to match degenerate letters literally.
  • The documentation for BioSequence lists the degenerate letters supported by each type of biomolecular sequence.
  • If the biomolecular sequence operated upon by StringDelete is circular, wraparound matches are possible.

Examples

open allclose all

Basic Examples  (4)

Remove whitespace from a string:

Remove a specific character sequence:

Delete substrings matching a string pattern:

Use the operator form of StringDelete:

Scope  (4)

Remove corresponding substrings from a biomolecular sequence:

Delete codon-length subsequences in a DNA sequence:

StringDelete respects the degenerate letters and circularity of the provided BioSequence:

Use Verbatim to restrict degenerate letter matching to exact matches:

Options  (1)

IgnoreCase  (1)

Delete substrings regardless of case:

Wolfram Research (2015), StringDelete, Wolfram Language function, https://reference.wolfram.com/language/ref/StringDelete.html (updated 2020).

Text

Wolfram Research (2015), StringDelete, Wolfram Language function, https://reference.wolfram.com/language/ref/StringDelete.html (updated 2020).

CMS

Wolfram Language. 2015. "StringDelete." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/StringDelete.html.

APA

Wolfram Language. (2015). StringDelete. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringDelete.html

BibTeX

@misc{reference.wolfram_2024_stringdelete, author="Wolfram Research", title="{StringDelete}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/StringDelete.html}", note=[Accessed: 18-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_stringdelete, organization={Wolfram Research}, title={StringDelete}, year={2020}, url={https://reference.wolfram.com/language/ref/StringDelete.html}, note=[Accessed: 18-December-2024 ]}