Project

General

Profile

« Previous | Next » 

Revision 5432

strings.py: Replaced no longer used contains_any() with find_any(), which returns any found substring, or None if none of the substrings were found

View differences:

lib/strings.py
64 64
    elif require: raise Exception(urepr(str_)+' needs '+urepr(suffix)+' suffix')
65 65
    else: return str_
66 66

  
67
def contains_any(haystack, needles):
67
def find_any(haystack, needles):
68 68
    for needle in needles:
69
        if haystack.find(needle) >= 0: return True
70
    return False
69
        if haystack.find(needle) >= 0: return needle
70
    return None
71 71

  
72 72
def overlaps(str0, str1): return str0.find(str1) >= 0 or str1.find(str0) >= 0
73 73

  

Also available in: Unified diff