Today i received my homework assignment for this week and i finished every question except one. The question is: "Write a Program that requests a word containing "r" and "n" as input and determines where the two letters appear first.
Just wondering how i should approach this i need to use a loop somewhere but i am confused as to how or what sort of code i should use. I know there needs to be a index to find the letter i just don't know how to screen the word to look for r and n using a loop.
The String.IndexOf method will tell you whether a String contains a specific character or substring and, if it does, at what index it first appears. If you want to find all occurrences you can call IndexOf repeatedly, using the index of the previous occurrence to determine the start index for searching for the next. -1 is returned when the value isn't found.