[utils] Allow None in remove_{start,end}
This commit is contained in:
parent
b78531a36a
commit
46bc9b7d7c
2 changed files with 14 additions and 6 deletions
|
@ -1549,15 +1549,11 @@ def setproctitle(title):
|
|||
|
||||
|
||||
def remove_start(s, start):
|
||||
if s.startswith(start):
|
||||
return s[len(start):]
|
||||
return s
|
||||
return s[len(start):] if s is not None and s.startswith(start) else s
|
||||
|
||||
|
||||
def remove_end(s, end):
|
||||
if s.endswith(end):
|
||||
return s[:-len(end)]
|
||||
return s
|
||||
return s[:-len(end)] if s is not None and s.endswith(end) else s
|
||||
|
||||
|
||||
def remove_quotes(s):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue