hasDigit(): Avoid a string copy as this is in a critical path for inline spellchecking.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33403 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2010-02-10 06:51:49 +00:00
parent defa62aa3d
commit 4c2a354ebd

View File

@ -320,17 +320,14 @@ bool hasDigit(docstring const & str)
if (str.empty())
return false;
// Remove leading and trailing white space chars.
docstring const tmpstr = trim(str);
if (tmpstr.empty())
return false;
docstring::const_iterator cit = tmpstr.begin();
docstring::const_iterator end = tmpstr.end();
for (; cit != end; ++cit)
docstring::const_iterator cit = str.begin();
docstring::const_iterator const end = str.end();
for (; cit != end; ++cit) {
if (*cit == ' ')
continue;
if (isdigit((*cit)))
return true;
}
return false;
}