我正在尝试获取字符串hello world.
这是我到目前为止所得到的:
$file = "1232#hello world#";
preg_match("#1232\#(.*)\##", $file, $match)
Run Code Online (Sandbox Code Playgroud) 我尝试为树中的每一行添加一个数字.树和它的编号工作但不是很好,那么有没有其他最好的方法来实现它?因为如果树节点扩展了,我必须获得所有扩展树节点并增加其编号.我还使用TreeViewer来创建树.
// base container
Composite composite = new Composite( (Composite) parent, SWT.NONE );
composite.setLayout( new GridLayout( 2, false ) );
composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
// The container for numbering in the tree
Composite numComposite = new Composite( composite, SWT.NONE );
numComposite.setLayout( new FillLayout( SWT.VERTICAL ) );
numComposite.setLayoutData( new GridData( GridData.VERTICAL_ALIGN_BEGINNING ) );
// the tree container
MyTree tree = new MyTree( composite );
tree.setContentProvider( new ContentProvider() );
Label test = new Label( numComposite, SWT.NONE ); …Run Code Online (Sandbox Code Playgroud)