Hi guys,
I'm parsing a string and I'd like to extract some relevant information in a TCL.
The string:
[red]rev_lca[/red] connects [red] lower_control_arm [/red] with [red]subframe [/red] (Force) [red]2 [/red] [red] lca_front lca_rear [/red]
the portions in red is what I'm after, the rest is junk...
Now I can do this:
and this seems to do the trick EXCEPT... some lines might have (Revolute Joint) instead of (Force) throwing a wrench in my logic.
In other words lindex takes the blanks as the separations between the various string constituents.
How can I handle the general case?
How can I ignore whatever is contained in '('?
Or if there is a better way to do that...
Thanks a lot!
Andrea.
I'm parsing a string and I'd like to extract some relevant information in a TCL.
The string:
[red]rev_lca[/red] connects [red] lower_control_arm [/red] with [red]subframe [/red] (Force) [red]2 [/red] [red] lca_front lca_rear [/red]
the portions in red is what I'm after, the rest is junk...
Now I can do this:
Code:
set joint_name [lindex $line 0]
set part_1 [lindex $line 2]
set part_2 [lindex $line 4]
set joint_loc_type [lindex $line 6]
set joint_loc_dep1 [lindex $line 7]
set joint_loc_dep2 [lindex $line 8]
and this seems to do the trick EXCEPT... some lines might have (Revolute Joint) instead of (Force) throwing a wrench in my logic.
In other words lindex takes the blanks as the separations between the various string constituents.
How can I handle the general case?
How can I ignore whatever is contained in '('?
Or if there is a better way to do that...
Thanks a lot!
Andrea.