summaryrefslogtreecommitdiff
path: root/TMPro/TMP_DigitValidator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'TMPro/TMP_DigitValidator.cs')
-rw-r--r--TMPro/TMP_DigitValidator.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/TMPro/TMP_DigitValidator.cs b/TMPro/TMP_DigitValidator.cs
new file mode 100644
index 0000000..80e3a77
--- /dev/null
+++ b/TMPro/TMP_DigitValidator.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace TMPro;
+
+[Serializable]
+public class TMP_DigitValidator : TMP_InputValidator
+{
+ public override char Validate(ref string text, ref int pos, char ch)
+ {
+ if (ch >= '0' && ch <= '9')
+ {
+ pos++;
+ return ch;
+ }
+ return '\0';
+ }
+}