MCPcopy Index your code
hub / github.com/webpy/webpy / _strips

Function _strips

web/utils.py:298–312  ·  view source on GitHub ↗
(direction, text, remove)

Source from the content-addressed store, hash-verified

296
297
298def _strips(direction, text, remove):
299 if isinstance(remove, iters):
300 for subr in remove:
301 text = _strips(direction, text, subr)
302 return text
303
304 if direction == "l":
305 if text.startswith(remove):
306 return text[len(remove) :]
307 elif direction == "r":
308 if text.endswith(remove):
309 return text[: -len(remove)]
310 else:
311 raise ValueError("Direction needs to be r or l.")
312 return text
313
314
315def rstrips(text, remove):

Callers 2

rstripsFunction · 0.85
lstripsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected