VIM:有谁知道如何将输入对话框中的字符串放入列表中?
例如:
字符串“3,5,12,15”
到:
list item[1] = 3
list item[2] = 5
list item[3] = 12
etc.
我怎么知道有多少个列表项?
最佳答案
来自 :h E714
:let l = len(list) " number of items in list
:let list = split("a b c") " create list from items in a string
在你的情况下,
let string = "3,5,7,19"
let list = split(string, ",")
echo len(list)
关于list - ViM:如何将输入对话框中的字符串放入列表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5449778/