Subversion Repositories HomeAutomation

Rev

Rev 997 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 997 Rev 1008
Line 273... Line 273...
273
string trim(string s)
273
string trim(string s)
274
{
274
{
275
    return trim(s, ' ');
275
    return trim(s, ' ');
276
}
276
}
277
 
277
 
278
string trim(string s, char c)
278
string trim(const string s, char c)
279
{
279
{
-
 
280
    string result = s;
280
    while (s[0] == c)
281
    while (result[0] == c)
281
        s.erase(0, 1);
282
        result.erase(0, 1);
282
 
283
 
283
    while (s[s.length()-1] == c)
284
    while (result[result.length()-1] == c)
284
        s.erase(s.length()-1, 1);
285
        result.erase(result.length()-1, 1);
285
 
286
 
286
    return s;
287
    return result;
287
}
288
}
288
 
289
 
289
int stoi(const string s)
290
int stoi(const string s)
290
{
291
{
291
    istringstream in(s);
292
    istringstream in(s);