コード例 #1
0
        // strip punctuaction, then trim
        public static string StripPunctuation(string inTerm)
        {
            int length = inTerm.Length;

            char[] temp  = new char[length];
            int    index = 0;

            for (int i = 0; i < length; i++)
            {
                char tempChar = inTerm[i];
                if (CharUtil.IsPunctuation(tempChar) == false)
                {
                    temp[index] = tempChar;
                    index++;
                }
            }
            string @out = new string(temp);

            return(@out.Trim(new char[] { ' ', '\x00' }));            // must be trimmed
        }