Tuesday, 2 February 2016

Length position of string

using System;

public class StringPostion
{
   public static void Main()
   {
      String str = "Sunil";
      String toFind = "s";
      int index = str.IndexOf("s");
      Console.WriteLine("Found '{0}' in '{1}' at position {2}",
                        toFind, str, index);
   }
}
--------------------
OUTPUT:
Found 'S' in 'sunil' at Position 1
---------------------------

No comments:

Post a Comment