Return to Snippet

Revision: 12056
at February 28, 2009 19:18 by spark9


Initial Code
public static string Left(string param, int length)
        {
            //we start at 0 since we want to get the characters starting from the
            //left and with the specified lenght and assign it to a variable
            string result = param.Substring(0, length);
            //return the result of the operation
            return result;
        } 
        public static string Right(string param, int length)
        {
            //start at the index based on the lenght of the sting minus
            //the specified lenght and assign it a variable
            string result = param.Substring(param.Length - length, length);
            //return the result of the operation
            return result;
        }

Initial URL

                                

Initial Description

                                

Initial Title
C# String Left and Right

Initial Tags

                                

Initial Language
C#