(beginner) apply ToLower

Fikakakan

Member
Joined
Jul 14, 2021
Messages
5
Programming Experience
Beginner
//My assignment in school asks me to make the input to Upper or Lower case. But I don't see how I do that here..


ToLower the input:
{
                        Console.WriteLine("Lägg till något i ryggan: ");
                        ryggSaker[index] = Console.ReadLine();
                        Console.WriteLine("Du la till " + ryggSaker[index]);
                        index++;
                    }
 
Do you understand what "make the input to Upper or Lower case" actually means? Do you understand where the input is in that code? Have you searched the web for examples of converting text to upper- or lower-case?
 
We haven't been taught the explanation, tgis is an extra thing I can add to my code for extra points. I'm suppose to look in up myself.
I've watch this YouTube clip and it's not hard to understand but I just don't see how I can apply it to my code.


I understand the attachement to a variable... But in my code the input is set to a index in the array.
 
Firstly, try using a proper tutorial rather than YouTube clips. You appear not to understand how arrays work so that's probably what you need to work on.

Secondly:
in my code the input is set to a index in the array.
Nope. That's nonsensical. The input is assigned to an element in the array. The index simply identifies which element it is.

Consider the following. If there was an egg on your kitchen bench and I told you to crack that egg into a bowl, could you do it? Of course you could. Now, if there was a carton of eggs on your kitchen bench and I told you to get the third egg from the carton and crack it into a bowl, could you do that? Of course you could. You wouldn't even have to think twice. An egg is still an egg, whether it's on its own or in an egg carton, and you don't need it explained to you how to get one item from a group based on a number.

Given that, why are you trying to make this difficult? A string is still a string, whether it is on its own, i.e. assigned to a variable, or in an array. You don't need it explained to you how to access a string in an array because you're already doing it in your code. Line 3 assigns the string to the array element by index and line 4 gets the string from the array element by index in order to display it. If you can get the string into and out of the array, what exactly is stopping you calling a method on that string?
 
Back
Top Bottom