Skip to content

Commit 3a3529c

Browse files
committed
updated remove function
1 parent 55b771c commit 3a3529c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

string_py/string_py.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,19 @@ def generate(self, length: int = None, min_: int = None, max_: int = None) -> st
130130
else:
131131
raise AttributeError("min_ and max_ or length must have a value")
132132

133-
def remove(self, chars: str) -> str:
133+
def remove(self, chars: str | list[str]) -> str:
134134
"""Remove chars from string
135135
136136
Parameters:
137137
-----------
138138
:param chars:
139139
The chars you want to remove
140140
"""
141-
return self.values.replace(chars, "")
141+
if type(chars) is str:
142+
list(chars)
143+
for x in chars:
144+
self.values.replace(x, "")
145+
return self.values
142146

143147
def split(self, each: int = None, chars: str = None) -> list[str]:
144148
"""An extension of the built-in .split method. Also split on certain index

0 commit comments

Comments
 (0)