Revision 5299
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/strings.py | ||
---|---|---|
33 | 33 |
# Use raw_extra_len() because Unicode characters can be multi-byte, and |
34 | 34 |
# length limits often apply to the byte length, not the character length. |
35 | 35 |
max_len -= raw_extra_len(str0)+raw_extra_len(str1) |
36 |
return str0[:max_len-len(str1)]+str1 |
|
36 |
str0_new_len = max_len - len(str1) |
|
37 |
if str0_new_len < 0: return str1[:max_len] # str1 too long |
|
38 |
return str0[:str0_new_len]+str1 |
|
37 | 39 |
|
38 | 40 |
def split(sep, str_): |
39 | 41 |
'''Returns [] if str_ == ""''' |
Also available in: Unified diff
strings.py: concat(): Fixed bug where end index of returned str0 portion would wrap around to a negative number if str1 itself was too long, causing incorrect truncation