Click here to Skip to main content
11,408,835 members (60,476 online)
Click here to Skip to main content

Yet another string parser

, 15 Mar 2002
Rate this:
Please Sign up or sign in to vote.
Another class for extracting fields of string

Sample screenshot

<!-- Add the rest of your HTML here -->


This is just another string parser that can be used either for command line or for CSV file for instance. This implementation uses the minimum amount of memory and time to parse a string into tokens.

Sample code

CStringParser args;
args.Parse( ::GetCommandLine(), poCmdLine ); 
args.Parse( _T("\"BOS011\" \"2001/04/09 08:49:09:0"
  "\" \"Hooker\" \"\" \"Boston\" \"No SMS "
  "client detected\" \"No\" \"No\""), poCsvLine ); 
args.Parse( _T("BOS011,\"GHA\",\"\",\"\","
  "Microsoft Windows NT Advanced Server 4.0,BOSTON,BOSTON,"
  "SSMS1,2.00.1493.2009,5,1"), CParseOptions( ',', '"', '\0', FALSE ) );


There are 2 projects to try this class - One is a simple console, the other is a complete GUI dialog box application to check each possibility of the class (using MFC). Have a nice trip with it.

Sorry for the lack of proper documentation but still have no time for it. Just read the code -both classes are not too hard.


By the way, I did some changes in the parser :

  • Can keep the quotes in the parsed argument by SetKeepQuote(true).
  • Can get the trailing null argument by SetRTrim(false).


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author


France France
No Biography provided

Comments and Discussions

GeneralIt has a bug [modified] PinmemberAli Rafiee15-Jul-08 12:06 
GeneralGood job PinmemberN5ARW19-Jan-07 13:16 
GeneralANSI string version also available PinmemberBill Kudrle25-Jul-03 14:04 
GeneralDouble Quote Bug Fix Pinmember_dew_20-Jul-03 22:38 
GeneralVery good, exellect, (except one point) Pinmembersequaier25-Nov-02 16:58 
GeneralRe: Very good, exellect, (except one point) PinmemberRemon26-Nov-02 9:00 
GeneralRe: Checked it.. ^^ Pinmembersequaier27-Nov-02 14:00 
GeneralNice code!!! PinmemberAnonymous7-Mar-02 5:37 
GeneralI like it PinmemberAnonymous12-May-01 12:16 
QuestionDocs? PinmemberAnonymous25-Apr-01 12:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150414.5 | Last Updated 16 Mar 2002
Article Copyright 2001 by Remon
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid