473,327 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Parse numbers out of a string

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.
--
Cheers,
Craig C Dallas,TX
Jul 21 '05 #1
2 4797
use keyword indexof

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

read books;
regards
Craig C wrote:
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.


Jul 21 '05 #2
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" <Cr****@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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.
--
Cheers,
Craig C Dallas,TX

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: N | last post by:
Hi, I would like to parse out each value that is seperated by a comma in a field and use that value to join to another table. What would be the easiest way to do so without having to write a...
2
by: probashi | last post by:
Hi, I am trying to the following: String s = "( 54.05)"; decimal d = decimal.Parse(s); when s = "( 54.05)" I what the value -54.05 and s = " 54.05" I what the value 54.05
8
by: moondaddy | last post by:
I'm writing an app in vb.net 1.1 and I need to parse strings that look similar to the one below. All 5 rows will make up one string. I have a form where a use can copy/paste data like what you...
4
by: Phil Mc | last post by:
OK this should be bread and butter, easy to do, but I seem to be going around in circles and not getting any answer to achieving this simple task. I have numbers in string format (they are...
9
by: Python.LeoJay | last post by:
Dear all, i need to parse billions of numbers from a file into float numbers for further calculation. i'm not satisfied with the speed of atof() function on my machine(i'm using visual c++ 6)....
6
by: giannik | last post by:
I have an Enum Structure Public Enum MyEnum EnumVal1=0 EnumVal2=1 EnumVal2=2 end enum I save in an access database this enum value as an integer (0=EnumVal1,
10
by: Michael B. Trausch | last post by:
Alright... I am attempting to find a way to parse ANSI text from a telnet application. However, I am experiencing a bit of trouble. What I want to do is have all ANSI sequences _removed_ from...
5
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
2
by: hsachdevah | last post by:
Hi, I developed an application for my study project to do some mathematical calculations. In this application, I am reading from a text file which contains some numbers. Now the problem is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.