Check a string for a char

bool FindS (string strMain, string strWord, int &pos) {
if (strMain.find(strWord) == 'npos'){ //not found
return (false);
} else{ //found
pos = strMain.find(strWord); //position
return (true);
}
}

-- ChiaMingKuo - 03-Feb-2010

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2010-02-03 - ChiaMingKuo
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback