Lowercase lettter in a string ?

  • Thread starter Thread starter Marlon R
  • Start date Start date
Hi, Marlon,

fastest in complexity or in writing?

You can use simply
if (mystring.ToLower() != mystring)

If you need fastest in execution then I don't have simple answer. It depends
on strings - how big they are and where from come

HTH
Alex
 
Marlon R said:
What is the fastest way to tell in string contains lower case letters?

Not quite sure I understand your question but if you want to tell if a
string contains "any" lowercase letters then you can use regex.

if(Regex.IsMatch("ABsF", "[a-z]", RegexOptions.Compiled |
RegexOptions.IgnorePatternWhitespace))
{
MessageBox.Show("Match");
}

which will show "Match" if "any" of the characters in the string are
lowercase.

HTH
JB
 
Back
Top