問題:
I have an input string and I want to verify that it contains:我有一個輸入字符串,我想驗證它是否包含:
- Only letters or只有字母或
- Only letters and numbers or只有字母和數字或
- Only letters, numbers or underscore只有字母、數字或下劃線
To clarify, I have 3 different cases in the code, each calling for different validation.澄清一下,我在代碼中有 3 種不同的情況,每種情況都需要不同的驗證。 What's the simplest way to achieve this in C#?在 C# 中實現這一目標的最簡單方法是什麼?
解決方案:
參考一: https://en.stackoom.com/question/4xL9參考二: https://stackoom.com/question/4xL9