Mathematica 9 is now available

DeleteCases

Usage

DeleteCases[expr, pattern] removes all elements of expr which match pattern.
DeleteCases[expr, pattern, levspec] removes all parts of expr on levels specified by levspec which match pattern.
DeleteCases[expr, pattern, levspec, n] removes the first n parts of expr which match pattern.


Notes

• Example: DeleteCases[ 1, a, 2, b , _Integer]LongRightArrow .
• With the option Heads -> True, you can delete heads with DeleteCases. Deleting the head of a particular element in an expression is equivalent to applying FlattenAt to the expression at that point.
• Example: DeleteCases[ 1, f[2, 3], 4 , f,  2 , Heads -> True]LongRightArrow .
• Level specifications are described in Section A.3.6.
• See Section 2.3.2.
• See also: Cases, ReplaceAll, Delete.
• New in Version 2; modified in 4.1.


Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.