String Index Of - CSharp System

CSharp examples for System:String Search

Description

String Index Of

Demo Code

/*/* ww  w  . j a va  2  s  .  c  o  m*/
   * Copyright: Thomas McGlynn 1997-2007.
   * 
   * The CSharpFITS package is a C# port of Tom McGlynn's
   * nom.tam.fits Java package, initially ported by  Samuel Carliles
   *
   * Copyright: 2007 Virtual Observatory - India.   
   *
   * Use is subject to license terms
   */
using System;

public class Main{
        public static int StringIndexOf(String s, Char c, int startIndex)
        {
            int result = -1;

            try
            {
                result = s.IndexOf(c, startIndex);
            }
            catch (Exception)
            {
                result = -1;
            }

            return result;
        }
}

Related Tutorials