i have a text file which contains a single line like 1,2,3,1,2. how do i read this text file and move integers to an array such that array contains only 12312.
blaze007
0
Newbie Poster
Recommended Answers
Jump to PostWhat have you got so far for yourself?
Did you consult MSDN? Example
Jump to PostI would do something like this:
List<int> myInts = new List<int>();
then in your for loop do:
myInts.Add(Convert.ToInt32(values[i]));
And if you really want an integer array, you can always use the ToArray method of the List class.
Hopeit helps!
All 8 Replies
ddanbe
2,724
Professional Procrastinator
Featured Poster
blaze007
0
Newbie Poster
ddanbe
2,724
Professional Procrastinator
Featured Poster
Jx_Man
987
Nearly a Senior Poster
Featured Poster
tinstaafl
1,176
Posting Maven
blaze007
0
Newbie Poster
blaze007
0
Newbie Poster
ddanbe
2,724
Professional Procrastinator
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.