Skip to main content

Text.is_digit

is_digitindex

Group: Logical

Documentation

Returns if a character from the text at the specified index (0-based) is a digit (0-9).

Arguments

  • index: The location in the text to get the character from. The index is also allowed to be negative, then the characters are counted from the end of the text, i.e. -1 will correspond to the last character.

Examples

Check if an individual character is a digit:

      "0".is_digit == True
"A0".is_digit == False
"A0".is_digit 1 == True
"건반(Korean)".is_digit 1 == False

Remarks

What is a Character?

A character is defined as an Extended Grapheme Cluster, see Unicode Standard Annex 29. This is the smallest unit that still has semantic meaning in most text-processing applications.