mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
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:
parent
defa62aa3d
commit
4c2a354ebd
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user