Start String - CSharp System

CSharp examples for System:String Start End

Description

Start String

Demo Code


using System.Text;
using System.Linq;
using System;// ww w .  j  av  a 2s  . c o  m

public class Main{
        public static string StartString(this string src, int numChars)
        {
            if (src == null) return null;
            if (src.Length >= numChars) return src.Substring(0, numChars);
            return src;
        }
}

Related Tutorials