blob: 11fc51447e46fc1353a5f403513704414b78c450 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
"""String processing utilities"""
def pivot(string, idx, keep_pivot=False):
"""
A function to split a string in two, pivoting at string[idx].
If keep_pivot is set, the pivot character is included in the second string.
Alternatively, it is omitted.
"""
if keep_pivot:
return (string[:idx], string[idx:])
else:
return (string[:idx], string[idx+1:])
|