This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

strip chars

Help for those learning Tcl or writing their own scripts.
Post Reply
w
whittinghamj
Op
Posts: 103
Joined: Sun May 21, 2006 4:50 pm

strip chars

Post by whittinghamj »

I have an output of

Code: Select all

123/4567.89
I am trying to strip out (delete) everything before the " / " AND get rid of the " / " as well. Any ideas please? the part of 123 will change from between 4 and 8 letters so cannot do a static removal - need to search for " / " and del everything < it if that makes sence

Thanks in advance
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Code: Select all

regsub {(.*?)/(.*?)} $inputvar {\2} outputvar
Check the tcl regsub manpage for details about subSpec and such.
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Re: strip chars

Post by TCL_no_TK »

Try using split
[lindex [split "123/4567.89" /] 1]
would return 4567.89 :)
w
whittinghamj
Op
Posts: 103
Joined: Sun May 21, 2006 4:50 pm

[ SOLVED} strip chars

Post by whittinghamj »

ty very much
Post Reply