Fix numeric SWKB validation (#5627)

* Fix numeric swkbd validation

* GTK
This commit is contained in:
Isaac Marovitz 2023-09-01 19:08:42 +01:00 committed by GitHub
parent 437c78e198
commit 12cbacffca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 9 deletions

View file

@ -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.

View file

@ -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();
}
}