[英]How to split a text(list) into sections(list) by a starting pattern in tcl
For example, my text is : 例如,我的文字是:
Block 1:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx
Block 2:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx
Block 3:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx
I want to split the by the different blocks, in tcl. 我想在tcl中拆分不同的块。 Eg:
例如:
{Block 1:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx}
{Block 2:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx}
{Block 3:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx}
Any way to make this work? 有什么办法使这项工作? Thanks!
谢谢!
Try the tcllib `textutil::splitx`` command. 尝试使用tcllib`textutil :: splitx``命令。 (see http://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/textutil/textutil.html#8 )
(见http://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/textutil/textutil.html#8 )
It can split text based on a regular expression. 它可以基于正则表达式拆分文本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.