2008-10-13 12 views
4

La bibliothèque standard Python est livrée avec le module textwrap qui fournit une fonctionnalité d'habillage de texte simple. Y a-t-il quelque chose de comparable dans la bibliothèque standard java?Existe-t-il une fonction de retour à la ligne dans la bibliothèque standard java?

en Python, il est quelque chose comme ceci:

>>> t = "a really really long string with lots of characters" 
>>> import textwrap 
>>> textwrap.wrap(t, 20) 
['a really really long', 'string with lots of', 'characters'] 
+0

pouvez-vous ajouter un exemple de fonctionnalité en Python? – danb

Répondre

8

Il n'y a pas dans la bibliothèque Java standard, mais il est dans Apache Commons:

WordUtils.wrap

Questions connexes