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']
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2352 次 |
| 最近记录: |