You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Components/Utilities/MaskAlgorithms/MaskChar.cs

28 lines
776 B

// Copyright (c) MudBlazor 2021
// MudBlazor licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Connected;
public struct MaskChar
{
public MaskChar(char c, string regex)
{
Char = c;
Regex = regex;
}
public char Char { get; set; }
public string Regex { get; set; }
public static MaskChar Letter(char c) => new MaskChar { Char = c, Regex = @"\p{L}" };
public static MaskChar Digit(char c) => new MaskChar { Char = c, Regex = @"\d" };
public static MaskChar LetterOrDigit(char c) => new MaskChar { Char = c, Regex = @"\p{L}|\d" };
}