Fix numeric SWKB validation (#5627)

* Fix numeric swkbd validation

* GTK
This commit is contained in:
Isaac Marovitz
2023-09-01 20:08:42 +02:00
committed by GitHub
parent 437c78e198
commit 12cbacffca
5 changed files with 26 additions and 9 deletions
@@ -11,9 +11,9 @@
Default = 0,
/// <summary>
/// Only numbers allowed.
/// Only 0-9 or '.' allowed.
/// </summary>
NumbersOnly = 1,
Numeric = 1,
/// <summary>
/// Only ASCII characters allowed.
@@ -0,0 +1,17 @@
using System.Text.RegularExpressions;
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
{
public static partial class NumericCharacterValidation
{
public static bool IsNumeric(char value)
{
Regex regex = NumericRegex();
return regex.IsMatch(value.ToString());
}
[GeneratedRegex("[0-9]|.")]
private static partial Regex NumericRegex();
}
}