如何拆分下面的列表
\{ X.1.Agg-252 ethernet4/1 island ethernet10/1\} \{ X.1.Agg-252 ethernet4/2 island ethernet10/3\} \{ X.1.Agg-252 ethernet4/3 island ethernet10/5\}
如下所示:
Element 1 - X.1.Agg-252 ethernet4/1 island ethernet10/1
Element 2 X.1.Agg-252 ethernet4/2 island ethernet10/3
Element 3 X.1.Agg-252 ethernet4/3 island ethernet10/5
答案 0 :(得分:1)
set a "\{ X.1.Agg-252 ethernet4/1 island ethernet10/1\} \{ X.1.Agg-252 ethernet4/2 island ethernet10/3\} \{ X.1.Agg-252 ethernet4/3 island ethernet10/5\}"
set y [split $a \{\}]
foreach w $y {puts $w}
答案 1 :(得分:0)
var splits = yourString.Replace("{", string.Empty).Split('}');