Click here to Skip to main content
15,913,584 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralWTL - 7.5 Released - Open Source Pin
Ed Preston15-May-04 5:50
Ed Preston15-May-04 5:50 
GeneralRe: WTL - 7.5 Released - Open Source Pin
Jörgen Sigvardsson15-May-04 12:57
Jörgen Sigvardsson15-May-04 12:57 
GeneralRe: WTL - 7.5 Released - Open Source Pin
_Magnus_16-May-04 23:38
_Magnus_16-May-04 23:38 
GeneralRe: WTL - 7.5 Released - Open Source Pin
Jörgen Sigvardsson23-May-04 12:02
Jörgen Sigvardsson23-May-04 12:02 
Generalafter installing xp service pack 1 and latest windows update. Pin
ekklesia14-May-04 19:59
ekklesia14-May-04 19:59 
Generalerror PRJ0019: A tool returned an error code: Performing registration Pin
parkerpkthn14-May-04 7:33
parkerpkthn14-May-04 7:33 
GeneralString Parsing ! Pin
ra_sasi14-May-04 6:22
ra_sasi14-May-04 6:22 
GeneralRe: String Parsing ! Pin
Andrew Walker14-May-04 16:56
Andrew Walker14-May-04 16:56 
I recommend that you don't try to overload the stream insertion and extraction operators for strings, developers expect their tools to work in consistant ways - and this isn't.

For really simple parsing jobs it's easier to just search the string for the delimiting character and copy that substring out. For more complex tasks use a regular expression library like boost::regex.

#include <vector>
#include <string>

std::vector< std::string > parseString(const std::string& strin)
{
    std::string str = strin;
    std::vector< std::string > words;
    size_t splt = str.find("~");

    while(splt != string::npos)
    {
        string out = str.substr(0,splt);
        words.push_back( out );
        str = str.substr(splt+1,str.length());
        splt = str.find("~");
    }
    words.push_back( str );
    return words;
}



If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.

Rudyard Kipling

GeneralRe: String Parsing ! Pin
ra_sasi17-May-04 4:10
ra_sasi17-May-04 4:10 
GeneralRe: String Parsing ! Pin
Andrew Walker17-May-04 22:40
Andrew Walker17-May-04 22:40 
GeneralRe: String Parsing ! Pin
ra_sasi20-May-04 12:10
ra_sasi20-May-04 12:10 
GeneralITableCreation Pin
João Paulo Figueira12-May-04 7:28
professionalJoão Paulo Figueira12-May-04 7:28 
GeneralRe: ITableCreation Pin
João Paulo Figueira12-May-04 23:52
professionalJoão Paulo Figueira12-May-04 23:52 
General8-bit graphics display Pin
ted_yu11-May-04 14:49
ted_yu11-May-04 14:49 
GeneralRe: 8-bit graphics display Pin
John M. Drescher11-May-04 16:50
John M. Drescher11-May-04 16:50 
GeneralRe: 8-bit graphics display Pin
ted_yu11-May-04 18:18
ted_yu11-May-04 18:18 
Generaldifference between MIDL Compiler Versions 6.00.0361 and 5.01.0164 Pin
Tarundeep Singh Kalra10-May-04 20:05
Tarundeep Singh Kalra10-May-04 20:05 
General(WTL) XP style password edit box Pin
Ernesto D.10-May-04 17:53
Ernesto D.10-May-04 17:53 
GeneralRe: (WTL) XP style password edit box Pin
Jens Doose10-May-04 23:18
Jens Doose10-May-04 23:18 
GeneralRe: (WTL) XP style password edit box Pin
Jason De Arte11-May-04 9:38
Jason De Arte11-May-04 9:38 
GeneralRe: (WTL) XP style password edit box Pin
Michael Dunn11-May-04 10:15
sitebuilderMichael Dunn11-May-04 10:15 
GeneralRe: (WTL) XP style password edit box Pin
Ernesto D.11-May-04 16:06
Ernesto D.11-May-04 16:06 
Generalstreams problem Pin
ra_sasi10-May-04 12:45
ra_sasi10-May-04 12:45 
GeneralRe: streams problem Pin
Joaquín M López Muñoz11-May-04 9:45
Joaquín M López Muñoz11-May-04 9:45 
GeneralRe: streams problem Pin
ra_sasi13-May-04 10:44
ra_sasi13-May-04 10:44 

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

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