On Fri, Dec 03, 2010 at 06:40:39PM +0100, Georg Baum wrote: > Stephan Witt wrote: > > > Am 03.12.2010 um 04:36 schrieb Enrico Forestieri: > > > >> 2) replace all occurrences of isDigit() with isDigitASCII() > > I don't know. Unless somebody goes through all usages and confirms that > indeed an ASCII digit is wanted I would rather keep it as it is.
Independent of the fact that an ASCII digit is wanted or not, actually isDigit() performs the same test as isDigitAscii(). From the Qt docs: bool QChar::isDigit () const Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false. And the other unicode categories addressed by Qt are: Number_Letter and Number_Other (http://doc.trolltech.com/4.7/qchar.html#Category-enum) So, it is pretty clear that isDigit() only tests for 0..9. This is reassured by the description of isNumber(): bool QChar::isNumber () const Returns true if the character is a number (Number_* categories, not just 0-9); otherwise returns false. See also isDigit(). So, I think that using isDigitASCII() in place of isDigit() is clearer. > >> 3) use QChar::isNumber() instead of iswdigit(). > > > > I'd have no problem with this. My goal was to get the thing fixed. > > IMHO, a wrapper around QChar::isNumber() in textutils.h and lstrings.cpp > > should be added then. > > If you want to use QChar::isNumber() for the spell checking test: Why not. > Unless somebody comes up with an example I believe that it basically does > not matter whether isDigit(), isDigitASCII() or QChar::isNumber() is used > there. Whatever you decide, please ensure that hasDigit() gets renamed > properly. IsDigit() and isDigitASCII() perform the exact same test. Now, I don't know whether QChar::isNumber() is appropriate for the spell checking test, but it for sure is not equivalent to the other two. Indeed, the first two only care for the Number_DecimalDigit category, while the latter is for all Number_* categories. Quoting http://en.wikipedia.org/wiki/Mapping_of_Unicode_characters : * Decimal digit (Nd) * Letter (Nl) — Numerals composed of letters or letterlike symbols (e.g., Roman numerals) * Other (No) — Includes vulgar fractions and superscript and subscript digits. -- Enrico