Added asap() and rsap() functions.
These functions are so simple that I am too lazy to explain their tasks.
This commit is contained in:
parent
2e42dd0cb4
commit
16424d1f23
1 changed files with 21 additions and 0 deletions
21
text.py
21
text.py
|
@ -90,5 +90,26 @@ class 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__":
|
||||
example()
|
||||
print(rsap("bfa", "l", 1))
|
||||
|
|
Loading…
Reference in a new issue