Skip to main content

complement

Function complement 

Source
pub fn complement(set: &[u8]) -> Vec<u8> 
Expand description

Parse a tr character set string into a Vec of expanded characters.

Supports:

  • Literal characters
  • Escape sequences: \, \a, \b, \f, \n, \r, \t, \v, \NNN (octal)
  • Ranges: a-z, A-Z, 0-9
  • Character classes: [:alnum:], [:alpha:], etc.
  • Equivalence classes: [=c=]
  • Repeat: [cn] or [c] (SET2 only, handled by caller) Build the complement of a character set: all bytes NOT in the given set. Result is sorted ascending (0, 1, 2, … 255 minus the set members).