예제 #1
0
        // strip leading chars if it is a punctuation
        public static string StripLeadChars(string inTerm, string specChars)
        {
            string outStrLead = inTerm;
            int    index      = 0;

            while ((index < outStrLead.Length) && (CharUtil.IsSpecifiedChar(outStrLead[index], specChars) == true))
            {
                index++;
            }
            if ((index > 0) && (index < outStrLead.Length))
            {
                outStrLead = outStrLead.Substring(index);
            }
            return(outStrLead);
        }
예제 #2
0
        // strip ending chars if it is a punctuation
        public static string StripEndChars(string inTerm, string specChars)
        {
            string outStrEnd = inTerm;
            int    length    = outStrEnd.Length;
            int    index     = length - 1;

            while ((index > -1) && (CharUtil.IsSpecifiedChar(outStrEnd[index], specChars) == true))
            {
                index--;
            }
            if ((index < length - 1) && (index > -1))
            {
                outStrEnd = outStrEnd.Substring(0, index + 1);
            }
            return(outStrEnd);
        }