Changeset 14365 for trunk/FACT++/src


Ignore:
Timestamp:
08/14/12 12:25:14 (12 years ago)
Author:
tbretz
Message:
Made sure that the Uncomment does not remove the escape characters; allow single and double hypen as escape character.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/tools.cc

    r14219 r14365  
    227227//!   one entry then for this entry the euqal sign was missing.
    228228//!
     229#include <iostream>
    229230map<string,string> Tools::Split(string &opt, bool allow)
    230231{
     
    234235    const string data(opt);
    235236
    236     const tokenizer<separator> tok(data, separator('\\', ' ', '\"'));
     237    const tokenizer<separator> tok(data, separator("\\", " ", "\"'"));
    237238
    238239    auto it=tok.begin();
     
    287288    typedef escaped_list_separator<char> separator;
    288289
    289     return *tokenizer<separator>(opt, separator('\\', '#', '\"')).begin();
    290 }
     290    const auto it = tokenizer<separator>(opt, separator('\\', '#', '\"')).begin();
     291
     292    const int charPos = it.base() - opt.begin();
     293
     294    return charPos<1 ? "" : opt.substr(0, opt[charPos-1]=='#' ? charPos-1 : charPos);
     295}
Note: See TracChangeset for help on using the changeset viewer.