Advertisement
Gillito

Untitled

Jun 4th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication30
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("input yor split char: ");
  14.             ConsoleKeyInfo usrKey = Console.ReadKey();
  15.             Console.WriteLine();
  16.            
  17.             int count = 0;
  18.             Console.WriteLine("input your string: ");
  19.             string str = Console.ReadLine();
  20.  
  21.             for (int i = str.IndexOf(usrKey.KeyChar) + 1; i < str.LastIndexOf(usrKey.KeyChar); i++)
  22.                 count++;
  23.             Console.WriteLine(count);
  24.             Console.ReadLine();
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement