Detect if a string contains uppercase characters

前端 未结 7 1066
孤城傲影
孤城傲影 2021-01-17 09:32

Is there an alternative to using a regular expression to detect if a string contains uppercase characters? Currently I\'m using the following regular expression:

<         


        
7条回答
  •  庸人自扰
    2021-01-17 09:47

    You could probably also do (if you want something that will work in .NET 1.0 :):

    bool hasUpperCase = !fullUri.ToLower().Equals(fullUri);
    

    Although a regex this simple will probably work fine

提交回复
热议问题