Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update strip.py
  • Loading branch information
its-100rabh authored Oct 8, 2023
commit 0260fb0a741f16d59ced0954c89e66d8e0bf0227
6 changes: 3 additions & 3 deletions strings/strip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def strip(user_string: str, characters: str | None = None) -> str:
def strip(user_string: str, characters: str = " \t\n\r") -> str:
"""
Remove leading and trailing characters (whitespace by default) from a string.

Expand All @@ -17,9 +17,9 @@ def strip(user_string: str, characters: str | None = None) -> str:
'world'
>>> strip("123hello123", "123")
'hello'
>>> strip("")
''
"""
if characters is None:
characters = " \t\n\r"

start = 0
end = len(user_string)
Expand Down