String Extraction
Posted: Mon Apr 19, 2004 9:13 am
This problem has been going round my brain all day.
What I have is a string in a database, holding details of players shown a yellow card in a football match. The string is held in a field called 'acards', in the format:
3|4|8 etc.
The '|' is a divider, and the numbers represent each player booked.
Now what I need to do is be able to extract the string, and then remove each number so that when I cycle through my 'for' loop of the team line-up, I can add a yellow card next to the appropriate players name. For example players 3, 4 & 8 from the above string.
The for loop and everything is all sorted nicely. What I need is to use some string formatting function to extract each number from the database. I just don't know the best way to do it!
This is my first post by the way...
What I have is a string in a database, holding details of players shown a yellow card in a football match. The string is held in a field called 'acards', in the format:
3|4|8 etc.
The '|' is a divider, and the numbers represent each player booked.
Now what I need to do is be able to extract the string, and then remove each number so that when I cycle through my 'for' loop of the team line-up, I can add a yellow card next to the appropriate players name. For example players 3, 4 & 8 from the above string.
The for loop and everything is all sorted nicely. What I need is to use some string formatting function to extract each number from the database. I just don't know the best way to do it!
This is my first post by the way...