Revision 2932
Added by Aaron Marcuse-Kubitza about 12 years ago
strings.py | ||
---|---|---|
7 | 7 |
|
8 | 8 |
##### Parsing |
9 | 9 |
|
10 |
def concat(str0, str1, max_len): return str0[:max_len-len(str1)]+str1 |
|
11 |
|
|
10 | 12 |
def split(sep, str_): |
11 | 13 |
'''Returns [] if str_ == ""''' |
12 | 14 |
if str_ == '': return [] |
... | ... | |
32 | 34 |
if removed_ref[0]: return str_[:-len(suffix)] |
33 | 35 |
else: return str_ |
34 | 36 |
|
35 |
def add_suffix(str_, suffix, max_len): return str_[:max_len-len(suffix)]+suffix |
|
36 |
|
|
37 | 37 |
def contains_any(haystack, needles): |
38 | 38 |
for needle in needles: |
39 | 39 |
if haystack.find(needle) >= 0: return True |
Also available in: Unified diff
strings.py, sql_gen.py: Renamed add_suffix() to concat() to reflect that this is a fixed-length replacement for +