sza*_*tan 0 ruby arrays string
我有一个像这样的字符串:
"John Godson Michael Meyer Ludovicio Sforza Cezar Borgia Alessandro Batista"
Run Code Online (Sandbox Code Playgroud)
如何将此字符串转换为字符串数组
# ["John", "Godson", "Michael Meyer" (...)]
Run Code Online (Sandbox Code Playgroud)
只需使用String#split
"John Godson Michael Meyer Ludovicio Sforza Cezar Borgia Alessandro Batista".split
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1643 次 |
| 最近记录: |