Read string input & return index of a char

PHOTO EMBED

Wed Jan 04 2023 16:09:26 GMT+0000 (Coordinated Universal Time)

Saved by @AlferM #c#

using System;
using System.Xml.Linq;

namespace ConsoleApp1
{
    internal class Program
    { 
        public static void Main(string[] args)
        {
            Console.WriteLine("Enter name: ");
            string userStringInput = Console.ReadLine();
            Console.WriteLine("Enter charactor to search: ");
            char userCharInput = Console.ReadLine()[0];

            Console.WriteLine(IndexOfChar(userStringInput, userCharInput));
        }

        //Conver to upper case()
        public static int IndexOfChar(string userString, char userChar) {
            int index = userString.IndexOf(userChar);
            return index;
        }
    }
}
content_copyCOPY