コード例 #1
0
        /// <summary>
        /// Parses the specified string.
        /// </summary>
        /// <param name="s">The string.</param>
        /// <returns>The CMapToUnicode or null if the characters map directly to unicode</returns>
        public static CMapToUnicode Parse(string s)
        {
            CMapToUnicode parse = new CMapToUnicode();

            InternalParseBFRange(s, parse);
            InternalParseBFChar(s, parse);

            return(parse.BFRanges.Count == 0 ? null : parse);
        }
コード例 #2
0
        private static void InternalParseBFRange(string s, CMapToUnicode parse)
        {
            string bfRange;
            int    beginBfRangePosition = s.IndexOf("beginbfrange", StringComparison.CurrentCultureIgnoreCase);

            if (beginBfRangePosition == -1)
            {
                return;
            }
            beginBfRangePosition += 12;

            int endBfRangePosition = s.IndexOf("endbfrange", beginBfRangePosition, StringComparison.CurrentCultureIgnoreCase);

            bfRange = s.Substring(beginBfRangePosition, endBfRangePosition - beginBfRangePosition);

            int i = 0;

            Statement.SkipSpace(bfRange, ref i);
            while (i < bfRange.Length)
            {
                parse.BFRanges.Add(BFRange.Parse(bfRange, ref i));
                Statement.SkipSpace(bfRange, ref i);
            }
        }