Skip to content

Commit 0bd3d0a

Browse files
committed
#25 - Implement method CppStringT::isdigit()
Completed.
1 parent 66d1acd commit 0bd3d0a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cpp-strings/cppstrings.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,21 @@ namespace pcs // i.e. "pythonic c++ strings"
412412

413413

414414
//--- isdigit() ---------------------------------------
415+
/** \brief Returns true if all characters in the string are digits and there is at least one character, or false otherwise.
416+
*
417+
* Digits include decimal characters and digits that need special
418+
* handling, such as the compatibility superscript digits. This
419+
* covers digits which cannot be used to form numbers in base 10,
420+
* like the Kharosthi numbers. Formally, a digit is a character
421+
* that has the property value Numeric_Type=Digit or Numeric_Type=Decimal.
422+
*
423+
* CAUTION: current implementation of library cpp-strings does
424+
* not implement above algorithm. It just returns the same result
425+
* as 'isdecimal()' which is NOT what Python str library does.
426+
*/
415427
inline const bool isdigit() const noexcept
416428
{
417-
return false;
429+
return isdecimal();
418430
}
419431

420432

0 commit comments

Comments
 (0)