mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-26 20:14:20 +01:00
Added utils.iter.startswith.
This commit is contained in:
parent
4f99f41266
commit
4808a68f7d
@ -148,4 +148,14 @@ def ilen(iterable):
|
|||||||
i += 1
|
i += 1
|
||||||
return i
|
return i
|
||||||
|
|
||||||
|
def startswith(long, short):
|
||||||
|
longI = iter(long)
|
||||||
|
shortI = iter(short)
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
if shortI.next() != longI.next():
|
||||||
|
return False
|
||||||
|
except StopIteration:
|
||||||
|
return True
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
Reference in New Issue
Block a user