Differences From Artifact [e964ece40d]:
- File gc_core/py/text.py — part of check-in [8fefa29d19] at 2017-06-04 10:13:39 on branch trunk — [core] getReadableError changed (user: olr, size: 4616) [annotate] [blame] [check-ins using] [more...]
To Artifact [72d4931466]:
- File gc_core/py/text.py — part of check-in [ec919db910] at 2017-08-15 08:12:57 on branch webext2 — [core][js][py] text.getParagraph(): end of line handling (user: olr, size: 4676) [annotate] [blame] [check-ins using] [more...]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | + | #!python3 import textwrap from itertools import chain def getParagraph (sText): "generator: returns paragraphs of text" iStart = 0 sText = sText.replace("\r\n", "\n").replace("\r", "\n") iEnd = sText.find("\n", iStart) while iEnd != -1: yield sText[iStart:iEnd] iStart = iEnd + 1 iEnd = sText.find("\n", iStart) yield sText[iStart:] |
︙ |