objstr: Add .splitlines() method.

splitlines() occurs ~179 times in CPython3 standard library, so was
deemed worthy to implement. The method has subtle semantic differences
from just .split("\n"). It is also defined as working for any end-of-line
combination, but this is currently not implemented - it works only with
LF line-endings (which should be OK for text strings on any platforms,
but not OK for bytes).
This commit is contained in:
Paul Sokolovsky
2015-04-04 00:09:23 +03:00
parent 82f37bf0d1
commit ac2f7a7f6a
6 changed files with 49 additions and 2 deletions

View File

@@ -299,6 +299,11 @@ Q(find)
Q(rfind)
Q(rindex)
Q(split)
#if MICROPY_PY_BUILTINS_STR_SPLITLINES
Q(splitlines)
Q(keepends)
Q(\n)
#endif
Q(rsplit)
Q(startswith)
Q(endswith)