C#LINGO问题仅使用字母A-Z [英] C# LINGO question only use the letters A-Z
本文介绍了C#LINGO问题仅使用字母A-Z的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我正在制作一款名为LINGO的游戏,但遇到了一些问题.在我们的任务中,我们仅允许使用字母< A-Z> ;,有人知道一个好的解决方案或代码吗?
最好的问候Carl
Hello, I am making a game called LINGO but I''ve run into a few problems. In our task we are only allowed to use the letters <A-Z>, anyone knows a good solution or code for that?
Best Regards Carl
推荐答案
我能想到的最简单的方法是创建一个包含合法字符的字符串,然后对照该字符串检查输入
The most simple method I can think of is to create a string that contains the legal characters, and then check the input against that string
string validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (validChars.Contains(input[input.Length -1])
{
// it's valid
}
这篇关于C#LINGO问题仅使用字母A-Z的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文