Getting information out of a string

T

Thomas

Hi!

I need help getting some information out of a text string.
The text string contains different id-numbers together with a minute
specification.
Example:
Textstring = "125(58),254(65),302(69),324(79)"

Now, the numbers 125, 254, 302, 324 are id-numbers of player names.
The numbers within () is which minute the player (id in front of it)
made a certain action.

Can I in some way loop this and add it to my database?

I have added it without looping but it´s a lot of writing and it would
be good to have it more automated.

Can anyone help me?
 
B

Bob Barrows [MVP]

Thomas said:
Hi!

I need help getting some information out of a text string.
The text string contains different id-numbers together with a minute
specification.
Example:
Textstring = "125(58),254(65),302(69),324(79)"

Now, the numbers 125, 254, 302, 324 are id-numbers of player names.
The numbers within () is which minute the player (id in front of it)
made a certain action.

Can I in some way loop this and add it to my database?

I have added it without looping but it´s a lot of writing and it would
be good to have it more automated.

Can anyone help me?

dim arPlayers,arPlayer,iID, iMinutes, i

arPlayers=split(textstring,",")
for i = 0 to ubound(arPlayers)
arPlayer = split(arPlayers(i),"(")
iID = CInt(arPlayer(0)
iMinutes=CInt(Left(arPlayer(1),len(arPlayer(1)) - 1))
'insert the id and minutes into your database here
next

HTH,
Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top