Parse numbers out of a string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using C# Application form button

numbers represent User IDs

I have a string with this value
s = "AGENTS/n090122/n098222/n989888/n676767/nEND OF DISPLAY"

I need to loop through the above for each id skip the text and then run a command foe each id im looping through.
Whats the best way to do this, Some Tokenizer or split?
Could anybody create me a example.
I am new to programming.
thanks for any help.
 
use keyword indexof

dim s as string="AGENTS/n090122/n098222/n989888/n676767/nEND OF DISPLAY"

read books;
regards
 
I would probably use string.split on the /n, which will create an array of
strings for you. Then look through each element in the array and see if the
values are numeric only - ie, can you cast to int. If you can then extract
the number and use it.

Start by looking up the split method and build yourself a simple example to
prove your concept.

Regards

John Timney
Microsoft Regional Director
Microsoft MVP


Craig C said:
Using C# Application form button

numbers represent User IDs

I have a string with this value
s = "AGENTS/n090122/n098222/n989888/n676767/nEND OF DISPLAY"

I need to loop through the above for each id skip the text and then run
a command foe each id im looping through.
 
Back
Top