コード例 #1
0
ファイル: dlstorm.cpp プロジェクト: jbworley/dlstorm
bool DLCODESTORM::dlcs_istrue(string text) {
    text=dlcs_tolower(text);
    if(text=="on")  return true;
    if(text=="1")   return true;
    if(text=="true")return true;
    if(text=="yes")  return true;
    return false;
}
コード例 #2
0
int DLCODESTORM::dlcs_count_words(string instr,string word) {
    unsigned int count=0;
    string s;
    s.assign(dlcs_tolower(instr.c_str()));
    word.assign(dlcs_tolower(word.c_str()));
    size_t found;
    int wl=word.length();
    found=s.find(word); if(found) count++;
    while(1) {
        found=s.find(word,found+1);
        if(found!=string::npos)
            count ++;
        else
            return count;
    }
    return count;
}