Just like the pop() function, but only returns the character if the given predicate test function succeeds.
( self, testfn )
| 1806 | return s |
| 1807 | |
| 1808 | def popif( self, testfn ): |
| 1809 | """Just like the pop() function, but only returns the |
| 1810 | character if the given predicate test function succeeds. |
| 1811 | """ |
| 1812 | c = self.peek() |
| 1813 | if c and testfn(c): |
| 1814 | self.__pos.advance( c ) |
| 1815 | return c |
| 1816 | return '' |
| 1817 | |
| 1818 | def pop_while_in( self, chars ): |
| 1819 | """Pops a sequence of characters at the current position |