Created
May 11, 2012 20:31
-
-
Save ptone/2662223 to your computer and use it in GitHub Desktop.
injects non-printing chars into long strings so that they will wrap properly in a fixed width div
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def softwrap(desc): | |
noprint = '​' | |
return ' '.join( | |
[noprint.join(list(x)) if (len(x) > 20) else x for x in desc.split()]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment