Wednesday, September 9, 2009

Stripping the Text

        public static string StripText(object textObj, int maxLength)

        {

            string text = string.Empty;

 

            if (textObj != null && !string.IsNullOrEmpty(textObj.ToString()))

            {

                text = textObj.ToString();

 

                if (text.Length > maxLength)

                {

                    text = text.Remove(maxLength);

                }

 

            }

 

            return text;

          

        }

No comments: