问题:
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