| View previous topic :: View next topic |
| Author |
Message |
Elfriede Halfop
Joined: 07 Aug 2007 Posts: 67
|
Posted: Mon May 31, 2010 7:33 am Post subject: change line output |
|
|
Hey guys
i have a mysql query which gives me eg as result:
{Tom 2} {Simon 67} {Phoenix 8} {Sally 12} {Richard 43}
how can i manipulate this list to look like
Tom: 2 Simon: 67 Phoenix: 8 ... ?
many thanks  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon May 31, 2010 7:51 am Post subject: |
|
|
Suppose $mylist is the list containing your data (I assume it's a list of lists). You can do the following:
| Code: | set output ""
foreach element $mylist {
# $element is a list containing {"Name" "Score"}
foreach {a b} $element {break}
append output "${a}: $b "
}
# now $output is a string containing the data in your desired form
|
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Elfriede Halfop
Joined: 07 Aug 2007 Posts: 67
|
Posted: Mon May 31, 2010 8:07 am Post subject: |
|
|
many thanks !  |
|
| Back to top |
|
 |
|