mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-27 11:59:05 +00:00
Add some Str!
methods
This commit is contained in:
parent
4184c5d1f2
commit
e44ba71aa5
2 changed files with 32 additions and 4 deletions
|
@ -52,11 +52,11 @@ class StrMut(): # Inherits Str
|
|||
return last
|
||||
else:
|
||||
return Error("Can't pop from empty `Str!`")
|
||||
def push(self, c: str):
|
||||
self.value += c
|
||||
def push(self, s: str):
|
||||
self.value += s
|
||||
def remove(self, idx: int):
|
||||
char = self.value[idx]
|
||||
self.value = self.value[:idx] + self.value[idx+1:]
|
||||
return char
|
||||
def insert(self, idx: int, c: str):
|
||||
self.value = self.value[:idx] + c + self.value[idx:]
|
||||
def insert(self, idx: int, s: str):
|
||||
self.value = self.value[:idx] + s + self.value[idx:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue