A AlexS Jun 7, 2004 #2 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
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
J James Curran Jun 7, 2004 #3 AlexS said: You can use simply if (mystring.ToLower() != mystring) Click to expand... er.umm... if (mystring.ToUpper() != mystring) (Imagine if mystring was all lower case to begin with.....) -- Truth, James Curran Home: www.noveltheory.com Work: www.njtheater.com Blog: www.honestillusion.com Day Job: www.partsearch.com (note new day job!)
AlexS said: You can use simply if (mystring.ToLower() != mystring) Click to expand... er.umm... if (mystring.ToUpper() != mystring) (Imagine if mystring was all lower case to begin with.....) -- Truth, James Curran Home: www.noveltheory.com Work: www.njtheater.com Blog: www.honestillusion.com Day Job: www.partsearch.com (note new day job!)
A AlexS Jun 7, 2004 #4 Right, good that someone remarked! Rgds Alex James Curran said: er.umm... if (mystring.ToUpper() != mystring) (Imagine if mystring was all lower case to begin with.....) -- Truth, James Curran Home: www.noveltheory.com Work: www.njtheater.com Blog: www.honestillusion.com Day Job: www.partsearch.com (note new day job!) Click to expand...
Right, good that someone remarked! Rgds Alex James Curran said: er.umm... if (mystring.ToUpper() != mystring) (Imagine if mystring was all lower case to begin with.....) -- Truth, James Curran Home: www.noveltheory.com Work: www.njtheater.com Blog: www.honestillusion.com Day Job: www.partsearch.com (note new day job!) Click to expand...
J John Baro Jun 8, 2004 #5 Marlon R said: What is the fastest way to tell in string contains lower case letters? Click to expand... 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
Marlon R said: What is the fastest way to tell in string contains lower case letters? Click to expand... 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