fork(4) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. string s="Something1, something2, something3, something4,something5";
  8. Console.WriteLine(getSpecifiedIndexOf(s,',',2));
  9. }
  10. public static int getSpecifiedIndexOf(string str,char ch,int index){
  11. int i = 0,o=1;
  12. while ((i = str.IndexOf(ch, i)) != -1)
  13. {
  14. if(o==index)return i;
  15. o++;
  16. i++;
  17. }
  18. return 0;
  19. }
  20. }
Success #stdin #stdout 0.03s 33760KB
stdin
Standard input is empty
stdout
, something2, something3, something4,something5
22