First there is filled in a sentence, and have to be split.
I think i splitted it but now i cant return the number of the index, i only get the number of the char.
I hope that some1 can help me.
Its written in C# console.
Like this: A line of words.
Then type one of the words like : line .
Than i need to get returned 1.
Expand|Select|Wrap|Line Numbers
- Console.WriteLine("Please fill in a line of words:");
- string st = Console.ReadLine(); // type the words
- string[] words = st.Split(new char[] { char.Parse(" ") }); // split up the words
- Console.WriteLine("Fill in a word of the line above: ");
- string LS = Console.ReadLine();
- //Console.ReadLine();
- Console.WriteLine(st.IndexOf(LS));
- Console.ReadLine();
Thanks in andvance
Greetings, Robba.