Question by
bjornskalkam · Sep 08, 2017 at 05:51 PM ·
c#scripting beginnersimpleeasy
Convert a char to upper case
So i've got this code
foreach (char c in Input.inputString) { //c.ToUpper (); Debug.Log (c); }
What it does if the second line is commented out is that every time i click a key, it's printed to the console. If I hold shift, the letter will be in caps. I would like the letter to always be in caps, no matter if I'm holding shift or not, but c.ToUpper is not working for me. I get this error:
Assets/moveText.cs(36,6): error CS1501: No overload for method ToUpper takes 0 arguments
Can somebody tell me what I'm doing wrong?
Comment
Answer by lorenzofman2 · Sep 08, 2017 at 06:45 PM
As stated on C# MSDN documentation here:
You need to feed your .ToUpper with the char variable that you want to be "uppered"
Change :
c.ToUpper();
To :
c = Char.ToUpper(c);
Hope this helps!