3 Apr
2019
3 Apr
'19
6:03 p.m.
Use "without" as the action picking up on "with" as in startswith, endswith: new_string = a_string.withoutprefix( prefix ) new_string = a_sring.withoutsuffix( suffix ) And since we have "replace" "remove" would also seem obvious. new_string = a_string.removeprefix( prefix ) new_string = a_sring.removesuffix( suffix ) I know that some commented that remove sounds like its inplace. But then so does replace. Would "replacesuffix" and "replaceprefix" work? I'd default the "replacement" to the empty string "". new_string = a_string.replaceprefix( old_prefix, replacement ) new_string = a_sring.replacesuffix( old_suffix, replacement ) Barry