mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Added utils.iter.startswith.
This commit is contained in:
parent
4f99f41266
commit
4808a68f7d
@ -148,4 +148,14 @@ def ilen(iterable):
|
||||
i += 1
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user