Selectively replace multiple instances of a character within a string: Difference between revisions
Selectively replace multiple instances of a character within a string (view source)
Revision as of 17:00, 28 July 2022
, 1 year ago→Python
m (→Python) |
|||
Line 529:
def nthInstanceReplaced(ruleMap):
def go(a, c):
deltas[i] or c if i < len(deltas) else c
)
else:
return a, c
return lambda s: ''.join(
|