Advertisement
NPSF3000

indexOf

May 30th, 2011
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             while (true)
  13.             {
  14.                 string str1, str2;
  15.  
  16.                 Console.WriteLine("Type the containing string");
  17.  
  18.                str1 = Console.ReadLine().ToLower();
  19.  
  20.                Console.WriteLine("Type A string to be found in the earlier string");
  21.  
  22.                str2 = Console.ReadLine().ToLower();
  23.  
  24.                Console.WriteLine("Result is "+ str1.IndexOf(str2).ToString() );
  25.  
  26.                Console.WriteLine("");
  27.                Console.WriteLine("Any key to loop, exit to exit");
  28.                if (Console.ReadLine().ToLower() == "exit") break;
  29.                Console.WriteLine("");
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement