In
this post, I'll show how you can filter out uppercase or lowercase words in a
string
Code
to find uppercase or lowercase words in given string:
var str = "Test String With lower And
UPPER Case";
//Find all Uppercase words
var upperItems = str.Split(' ')
.Where(s => String.Equals(s, s.ToUpper(),
StringComparison.Ordinal));
//Find all Lowercase words
var lowerItems = str.Split(' ')
.Where(s => String.Equals(s, s.ToLower(),
StringComparison.Ordinal));
|
Comments
Post a Comment