2022-10-09 09:13:15 -05:00
|
|
|
def replace(input_str, search_key, replace_str, checkspaces=False):
|
|
|
|
if replace_str is None:
|
|
|
|
input_str = replace(input_str, search_key, "", checkspaces)
|
|
|
|
else:
|
|
|
|
while input_str.find(search_key) != -1:
|
|
|
|
if checkspaces:
|
|
|
|
if input_str[input_str.index(search_key) - 1] != " ":
|
|
|
|
input_str = input_str.replace(search_key, " " + replace_str)
|
|
|
|
else:
|
|
|
|
input_str = input_str.replace(search_key, replace_str)
|
|
|
|
else:
|
2022-10-11 09:57:49 -05:00
|
|
|
input_str = input_str.replace(search_key, replace_str)
|
2022-10-09 09:13:15 -05:00
|
|
|
return input_str
|