made rtrim() and ltrim() global functions, to reduce code duplication (it seems parallaction/parser.cpp code re-use them too
svn-id: r25564
This commit is contained in:
parent
474d49dc14
commit
1ce912e106
6 changed files with 30 additions and 62 deletions
|
@ -431,5 +431,21 @@ String operator +(const String &x, const char *y) {
|
|||
return temp;
|
||||
}
|
||||
|
||||
char *ltrim(char *t) {
|
||||
while (isspace(*t))
|
||||
t++;
|
||||
return t;
|
||||
}
|
||||
|
||||
char *rtrim(char *t) {
|
||||
int l = strlen(t) - 1;
|
||||
while (l >= 0 && isspace(t[l]))
|
||||
t[l--] = 0;
|
||||
return t;
|
||||
}
|
||||
|
||||
char *trim(char *t) {
|
||||
return rtrim(ltrim(t));
|
||||
}
|
||||
|
||||
} // End of namespace Common
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue