Reputation:
Is there a "simple" way to capitalize a single char
-typed value?
This will work, but feels cumbersome and generally wrong:
var ch = 'a';
var cap = ("" + ch).ToUpper()[0];
cap.Dump(); // (in LINQPad) => 'A'
Notes:
"" + ch
over ToString()
is because ReSharper yells at me for not specifying a culture with the latter ... in any case, ch.ToString().ToUpper()[0]
feels just as cumbersome.char
that turns into a surrogate-pair when capitalized.Thanks,
Upvotes: 1
Views: 1702