Added asap() and rsap() functions.

These functions are so simple that I am too lazy to explain their tasks.
This commit is contained in:
The Wobbler 2024-01-05 22:14:36 +01:00
parent 2e42dd0cb4
commit 16424d1f23

21
text.py
View file

@ -90,5 +90,26 @@ class Log:
return self.log return self.log
def asap(old: str, add: str, position: int):
"""
ASAP = Add String At Position
(0 is the first character.)
"""
return old[:position] + add + old[position:]
def rsap(old: str, add: str, position: int):
"""
RSAP = Replace String At Position
(0 is the first character.)
"""
return old[:position] + add + old[position + 1:]
if __name__ == "__main__": if __name__ == "__main__":
example() example()
print(rsap("bfa", "l", 1))