Why cant I convert my chars into lower case

449 Views Asked by At

Im trying to take a string of characters check if any of the charachters in that string are lowercased, if that is the case I want to change them, but when im trying to use Char.ToLower() nothing happens.

Console.Clear();

string rightWord = "Arose";
//making all letters into small letters

//making a array of the right word
char[] rightWordArray = rightWord.ToCharArray();

for (int i = 0; i < rightWord.Length; i++)
{
    if (char.IsUpper(rightWordArray[i]))
    {
        char.ToLower(rightWordArray[i]);
    }
}

//writing out all chars in rightWordArray
foreach (var item in rightWordArray)
{
Console.WriteLine(item);
}



I have tried String.ToLower too but it doesent work.

1

There are 1 best solutions below

0
On

Per UnholySheep's comment:

char.ToLower(rightWordArray[i]); returns the input character converted to lower case. It does not modify the input in place