Just use strsplit
with \s+
to split on:
x <- "10012 ---- ---- ---- ---- CAB UNCH CAB"
x
# [1] "10012 ---- ---- ---- ---- CAB UNCH CAB"
strsplit(x, "\s+")[[1]]
# [1] "10012" "----" "----" "----" "----" "CAB" "UNCH" "CAB"
length(.Last.value)
# [1] 8
Or, in this case, scan
also works:
scan(text = x, what = "")
# Read 8 items
# [1] "10012" "----" "----" "----" "----" "CAB" "UNCH" "CAB"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…