Example #1
0
bool endsWith(const LITESQL_String& what, const LITESQL_String& with) {
    if (what.size() < with.size())
        return false;
    if (what.substr(what.size()-with.size(), what.size()) == with)
        return true;
    return false;
}
Example #2
0
bool startsWith(const LITESQL_String& what, const LITESQL_String& with) {
    if (what.size() < with.size())
        return false;
    if (what.substr(0, with.size()) == with)
        return true;
    return false;
}
Example #3
0
LITESQL_String lstrip(const LITESQL_String& s) {
    unsigned int pos = 0;
    while (1) {
        if (isspace(s[pos]) && pos < s.size()-1)
            pos++;
        else
            break;
    }
    return s.substr(pos, s.size());
}
Example #4
0
LITESQL_String rstrip(const LITESQL_String& s) {
    if (s.empty())
        return s;
    int pos = s.size()-1;
    while (1) {
        if (isspace(s[pos]) && pos > 0)
            pos--;
        else
            break;
    }
    return s.substr(0, pos+1);
}
Example #5
0
LITESQL_String decapitalize(const LITESQL_String& s) {
    if (s.empty())
        return s;
    LITESQL_Char buf[2] = {tolower(s[0]), 0};
    return LITESQL_String(buf) + s.substr(1, s.size());
}