[RESOLVED] string positions
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: [RESOLVED] string positions

Threaded View

  1. #1
    Join Date
    Jan 2011
    Location
    Vilnius/Utena, Lithuania
    Posts
    14

    [RESOLVED] string positions

    I have file looking something like this
    Code:
    qwe||$|aa|$|bgb|$|
    asd||$|bab|$|adw|$|
    zxc||$|ccd|$|wda|$|
    This code should is supposed to show me a messagebox with content of strings between "|$|",

    for example:
    Code:
    bab
    adw
    But its giving weird output. I'm guessing it has to do something with positions, but dunno what.

    Code:
    String ^ message;
    string part;
    size_t pos, pos2;
    pos = line.find("|$|");
    while (pos < line.rfind("|$|"))
    {
    	pos2 = line.find("|$|", pos+3);
    	part = line.substr(pos+3, pos2);
    	pos = pos2;
    	message = String::Concat(message, strToStr(part),"\n");
    }
    								
    MessageBox::Show(message, "You have");
    btw... strToStr() is converting from std::string to String and vice versa.
    Last edited by Migeria; January 19th, 2011 at 03:42 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center