Hi - I'm trying to get rid of the date/month/year on the end of these news headlines:
UK's Brown hopes Zimbabwe can rejoin Commonwealth 27 Nov 2009
At the moment I'm doing it by setting the 27 Nov 2009 part as a variable from another part of the webpage, and doing a string trimright to remove the variable. The problem then is, whenever a 27 or Nov or 2009 appears in the actual headline itself, it's trimming everything else with it:
eg.
African Markets - Factors to watch on Nov 27 27 Nov 2009
appears as just:
African Markets - Factors to watch on
any help to just lose the right-hand side date would be much appreciated!
I suppose ome way around would be to use the string range command. You'd have to get the length of the strings first though (string length) and do some maths...
Not sure if string trimright would do the trick either?
eg.
African Markets - Factors to watch on Nov 27 27 Nov 2009
appears as just:
African Markets - Factors to watch on
If it's always 3 space separated elements at the end you want omitted. You can use join, lrange and split to do it as well, assuming $text is our string.
set text [join [lrange [split $text] 0 end-3]]
<speechles> .tcl set text "African Markets - Factors to watch on Nov 27 27 Nov 2009"
<bot> Tcl: African Markets - Factors to watch on Nov 27 27 Nov 2009
<speechles> .tcl set text [join [lrange [split $text] 0 end-3]]
<bot> Tcl: African Markets - Factors to watch on Nov 27