- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Parsing Line
Operating System - HP-UX
1754312
Members
2649
Online
108813
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2009 02:50 AM
09-23-2009 02:50 AM
Parsing Line
I am using CSV file, and I need to parse in C++, I have some data I know how many columns I have.
########################
“user1”,”user2”,”user3”, “user4”,”user5”,
“use””r1”, “user,2”, “use,r3”,”user,rr,
Rr,rree4”,”user5”,
##########################
First line I am able to parse. But for second row I am facing issue if data is incomplete in 1st line I have to pick next line, until I find all the columns. Column separator is (,”). Please give compile code so that I can test. Reward assured for good answer.
How can I parse data of 2nd row, I am using STL, but I don’t know how to
find last of (,”) and (,” ) first of in next line.
It should return me for 2nd row.
“use””r1”
“user,2”
“use,r3”
”user,rr,Rr,rree4”
“user5”
########################
“user1”,”user2”,”user3”, “user4”,”user5”,
“use””r1”, “user,2”, “use,r3”,”user,rr,
Rr,rree4”,”user5”,
##########################
First line I am able to parse. But for second row I am facing issue if data is incomplete in 1st line I have to pick next line, until I find all the columns. Column separator is (,”). Please give compile code so that I can test. Reward assured for good answer.
How can I parse data of 2nd row, I am using STL, but I don’t know how to
find last of (,”) and (,” ) first of in next line.
It should return me for 2nd row.
“use””r1”
“user,2”
“use,r3”
”user,rr,Rr,rree4”
“user5”
- Tags:
- csv
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2009 07:24 AM
09-23-2009 07:24 AM
Re: Parsing Line
>Column separator is (,").
It seems you need a character orientated state machine that knows how to parse your CSV lines.
This would include removing "", collapsing the duplicated "". (It appears you don't care to do this, just recognize them and know when a comma is a separator.)
And most importantly knowing when to ignore the newline that's embedded in a quoted string.
This could be as simple as checking if the last two chars of a string are a: ",
If not, read another line and concatenate the two.
It seems you need a character orientated state machine that knows how to parse your CSV lines.
This would include removing "", collapsing the duplicated "". (It appears you don't care to do this, just recognize them and know when a comma is a separator.)
And most importantly knowing when to ignore the newline that's embedded in a quoted string.
This could be as simple as checking if the last two chars of a string are a: ",
If not, read another line and concatenate the two.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP