From 0f4d51f3ba406b921e4e4c0479a01f256b84dfd8 Mon Sep 17 00:00:00 2001 From: Rolux Date: Sun, 6 Jul 2008 12:34:09 +0200 Subject: [PATCH] wrapString(): defaults and tests --- oxlib/text.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/oxlib/text.py b/oxlib/text.py index 4978ebb..a3c746b 100644 --- a/oxlib/text.py +++ b/oxlib/text.py @@ -62,7 +62,13 @@ def wrap(text, width): text.split(' ') ) -def wrapString(string, length, separator, balance): +def wrapString(string, length=80, separator='\n', balance=False): + ''' + >>> wrapString("Anticonstitutionellement, Paris s'eveille", 16) + "Anticonstitution\nellement, Paris \ns'eveille" + >>> wrapString('All you can eat', 12, '\n', True) + 'All you \ncan eat' + ''' if balance: # balance lines: test if same number of lines # can be achieved with a shorter line length