<i id='y2EsQ'><tr id='y2EsQ'><dt id='y2EsQ'><q id='y2EsQ'><span id='y2EsQ'><b id='y2EsQ'><form id='y2EsQ'><ins id='y2EsQ'></ins><ul id='y2EsQ'></ul><sub id='y2EsQ'></sub></form><legend id='y2EsQ'></legend><bdo id='y2EsQ'><pre id='y2EsQ'><center id='y2EsQ'></center></pre></bdo></b><th id='y2EsQ'></th></span></q></dt></tr></i><div id='y2EsQ'><tfoot id='y2EsQ'></tfoot><dl id='y2EsQ'><fieldset id='y2EsQ'></fieldset></dl></div>
  • <small id='y2EsQ'></small><noframes id='y2EsQ'>

  • <legend id='y2EsQ'><style id='y2EsQ'><dir id='y2EsQ'><q id='y2EsQ'></q></dir></style></legend>

        <bdo id='y2EsQ'></bdo><ul id='y2EsQ'></ul>
    1. <tfoot id='y2EsQ'></tfoot>

        检查字符是否是字母

        时间:2023-05-20

          <tfoot id='GLm0Z'></tfoot>
        1. <i id='GLm0Z'><tr id='GLm0Z'><dt id='GLm0Z'><q id='GLm0Z'><span id='GLm0Z'><b id='GLm0Z'><form id='GLm0Z'><ins id='GLm0Z'></ins><ul id='GLm0Z'></ul><sub id='GLm0Z'></sub></form><legend id='GLm0Z'></legend><bdo id='GLm0Z'><pre id='GLm0Z'><center id='GLm0Z'></center></pre></bdo></b><th id='GLm0Z'></th></span></q></dt></tr></i><div id='GLm0Z'><tfoot id='GLm0Z'></tfoot><dl id='GLm0Z'><fieldset id='GLm0Z'></fieldset></dl></div>
        2. <small id='GLm0Z'></small><noframes id='GLm0Z'>

            1. <legend id='GLm0Z'><style id='GLm0Z'><dir id='GLm0Z'><q id='GLm0Z'></q></dir></style></legend>

                  <tbody id='GLm0Z'></tbody>
                  <bdo id='GLm0Z'></bdo><ul id='GLm0Z'></ul>
                  本文介绍了检查字符是否是字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我想检查一个字符串是否只包含正确的字母.我为此使用了 Char.IsLetter.我的问题是,当有像 é 或 á 这样的字符时,它们也被认为是正确的字母,这不应该是.

                  i want to check if a string only contains correct letters. I used Char.IsLetter for this. My problem is, when there are chars like é or á they are also said to be correct letters, which shouldn't be.

                  是否有可能将字符检查为正确的字母 A-Z 或 a-z 而没有像 á 这样的特殊字母?

                  is there a possibility to check a char as a correct letter A-Z or a-z without special-letters like á?

                  推荐答案

                  bool IsEnglishLetter(char c)
                  {
                      return (c>='A' && c<='Z') || (c>='a' && c<='z');
                  }
                  

                  您可以将此作为扩展方法:

                  You can make this an extension method:

                  static bool IsEnglishLetter(this char c) ...
                  

                  这篇关于检查字符是否是字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:为什么布尔值比字符消耗更多的内存? 下一篇:来自 Int 的 C# Char 用作字符串 - VB Chr() 的真正等价物

                  相关文章

                  <tfoot id='ssaE8'></tfoot>
                • <legend id='ssaE8'><style id='ssaE8'><dir id='ssaE8'><q id='ssaE8'></q></dir></style></legend>
                  <i id='ssaE8'><tr id='ssaE8'><dt id='ssaE8'><q id='ssaE8'><span id='ssaE8'><b id='ssaE8'><form id='ssaE8'><ins id='ssaE8'></ins><ul id='ssaE8'></ul><sub id='ssaE8'></sub></form><legend id='ssaE8'></legend><bdo id='ssaE8'><pre id='ssaE8'><center id='ssaE8'></center></pre></bdo></b><th id='ssaE8'></th></span></q></dt></tr></i><div id='ssaE8'><tfoot id='ssaE8'></tfoot><dl id='ssaE8'><fieldset id='ssaE8'></fieldset></dl></div>

                      • <bdo id='ssaE8'></bdo><ul id='ssaE8'></ul>

                    1. <small id='ssaE8'></small><noframes id='ssaE8'>