MCPcopy
hub / github.com/waditu/tushare / skipwhile

Method skipwhile

tushare/util/demjson.py:1741–1755  ·  view source on GitHub ↗

Advances the current position until a given predicate test function fails, or the end of the document is reached. Returns the actual number of characters skipped. The provided test function should take a single unicode character and return a boolean value, such as:

( self, testfn )

Source from the content-addressed store, hash-verified

1739 return self.cpos - i
1740
1741 def skipwhile( self, testfn ):
1742 """Advances the current position until a given predicate test
1743 function fails, or the end of the document is reached.
1744
1745 Returns the actual number of characters skipped.
1746
1747 The provided test function should take a single unicode
1748 character and return a boolean value, such as:
1749
1750 lambda c : c.isdigit() # Skip all digits
1751
1752 See also methods: skipuntil() and popwhile()
1753
1754 """
1755 return self.skipuntil( lambda c: not testfn(c) )
1756
1757 def skip_to_next_line( self, allow_unicode_eol=True ):
1758 """Advances the current position to the start of the next

Callers 1

skipwsMethod · 0.95

Calls 1

skipuntilMethod · 0.95

Tested by

no test coverage detected