473,410 Members | 1,916 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,410 software developers and data experts.

read key/value pairs from delimited text file into collection?

Ron
I have a text file with the following format (pipe delimited)

|column1=value|column2=value|column3=value|column4 =value|...
|column1=value|column2=value|column3=value|column4 =value|...
I have two questions.

1. Is this some new type of text file format and if so, what is the name of
it.
2. What functions can I use in .NET to read the key/value pairs into a
collection.

Thanks,

Ron
Nov 22 '05 #1
3 3260
Hmm..I'm not sure whether this is some new type of text file format but
reading it into a collection would be pretty simple. You could either use a
couple of String.Splits or take the regular expressions route .

--
Sriram Krishnan

http://www.dotnetjunkies.com/weblog/sriram
"Ron" <ba*****@online.nospam> wrote in message
news:A0**********************************@microsof t.com...
I have a text file with the following format (pipe delimited)

|column1=value|column2=value|column3=value|column4 =value|...
|column1=value|column2=value|column3=value|column4 =value|...
I have two questions.

1. Is this some new type of text file format and if so, what is the name
of
it.
2. What functions can I use in .NET to read the key/value pairs into a
collection.

Thanks,

Ron

Nov 22 '05 #2
Ron
Would it be possible to get a code sample of the regular expression route if
it is not too much trouble? I need to take this file and create afixed field
text file with just the values. The files are rather large so speed is
important. I was looking at the split function where i would have to read
one like at a time, and I am looking for the fastest way possible to do this.

Any help you can provide is appreciated. In the mean time, ill be looking
up the regexp route.

Thanks,

ron

"Sriram Krishnan" wrote:
Hmm..I'm not sure whether this is some new type of text file format but
reading it into a collection would be pretty simple. You could either use a
couple of String.Splits or take the regular expressions route .

--
Sriram Krishnan

http://www.dotnetjunkies.com/weblog/sriram
"Ron" <ba*****@online.nospam> wrote in message
news:A0**********************************@microsof t.com...
I have a text file with the following format (pipe delimited)

|column1=value|column2=value|column3=value|column4 =value|...
|column1=value|column2=value|column3=value|column4 =value|...
I have two questions.

1. Is this some new type of text file format and if so, what is the name
of
it.
2. What functions can I use in .NET to read the key/value pairs into a
collection.

Thanks,

Ron


Nov 22 '05 #3
Ron
Looks like i am gonna go with the split functions and a hash table.

thanks anyway,

Ron

"Ron" wrote:
Would it be possible to get a code sample of the regular expression route if
it is not too much trouble? I need to take this file and create afixed field
text file with just the values. The files are rather large so speed is
important. I was looking at the split function where i would have to read
one like at a time, and I am looking for the fastest way possible to do this.

Any help you can provide is appreciated. In the mean time, ill be looking
up the regexp route.

Thanks,

ron

"Sriram Krishnan" wrote:
Hmm..I'm not sure whether this is some new type of text file format but
reading it into a collection would be pretty simple. You could either use a
couple of String.Splits or take the regular expressions route .

--
Sriram Krishnan

http://www.dotnetjunkies.com/weblog/sriram
"Ron" <ba*****@online.nospam> wrote in message
news:A0**********************************@microsof t.com...
I have a text file with the following format (pipe delimited)

|column1=value|column2=value|column3=value|column4 =value|...
|column1=value|column2=value|column3=value|column4 =value|...
I have two questions.

1. Is this some new type of text file format and if so, what is the name
of
it.
2. What functions can I use in .NET to read the key/value pairs into a
collection.

Thanks,

Ron


Nov 22 '05 #4

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

Similar topics

1
by: bdinmstig | last post by:
I refined my attempt a little further, and the following code does seem to work, however it has 2 major problems: 1. Very limited support for XPath features Basic paths are supported for...
4
by: Bill | last post by:
If, for example, I retrieve a connectionstring from a config file using something like: Value = ConfigurationSettings.AppSettings; This will return a string that is semi-colon delimited. If I...
3
by: Ron | last post by:
I have a text file with the following format (pipe delimited) |column1=value|column2=value|column3=value|column4=value|... |column1=value|column2=value|column3=value|column4=value|... I have...
3
by: Jeff L. | last post by:
I have an interesting problem and I'm not coming up with any answers in my searches, so hopefully someone can give me a hand with this. I have a feeling it's easy, but I usually get my nose stuck...
5
by: Simon | last post by:
Hi all, I am writing a windows application using vb.net on the 1.1 framework. We have in the application, some strongly typed collections that have been written as classes that do not inherit...
5
by: Denis Petronenko | last post by:
Hello, how can i read into strings from ifstream? file contains values in following format: value11; val ue12; value 13; valu e21;value22; value23; etc. i need to read like file >string,...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
3
by: Ray | last post by:
Hello World, I made a Windowsform that reads data from a CSV file. It works fine, but when I have read the data of a record I have to re-Debug the form to read another record. So when I put a...
8
by: Andy B | last post by:
I have the object property StockContract.Dictionary which is a dictionary collection of <string, stringkey/value pairs. I need to be able to retreive the keys and their values and display them on a...
2
by: toodlez | last post by:
Hi, I'm pretty new to C++ and I want to find the min and max value in a collection of values. The pairs are in a text file and contain a descriptor and a value. For example: Bob 120 Jack 7 Larry -90...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.