Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java标准库中是否有文本换行功能?_Java - Fatal编程技术网

java标准库中是否有文本换行功能?

java标准库中是否有文本换行功能?,java,Java,Python标准库附带了模块textwrap,该模块提供了简单的文本包装功能。java标准库中有类似的东西吗 在Python中是这样的: >>> t = "a really really long string with lots of characters" >>> import textwrap >>> textwrap.wrap(t, 20) ['a really really long', 'string with lots of',

Python标准库附带了模块
textwrap
,该模块提供了简单的文本包装功能。java标准库中有类似的东西吗

在Python中是这样的:

>>> 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']

标准Java库中没有,但Apache Commons中有:


您能在Python中添加一个该功能的示例吗?该功能现在已被弃用,并被commons文本取代,