Revision 4115
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/strings.py | ||
---|---|---|
16 | 16 |
|
17 | 17 |
##### Parsing |
18 | 18 |
|
19 |
def raw_extra_len(str_): |
|
20 |
'''Calculates the difference between the character length and byte length of |
|
21 |
a string. These lengths will differ for Unicode strings containing |
|
22 |
multi-byte characters.''' |
|
23 |
return len(to_raw_str(str_))-len(str_) |
|
24 |
|
|
19 | 25 |
def concat(str0, str1, max_len): |
20 | 26 |
# Use to_unicode so that substring does not split Unicode characters |
21 | 27 |
str0, str1 = map(to_unicode, [str0, str1]) |
Also available in: Unified diff
strings.py: Added raw_extra_len()