コード例 #1
0
        /// <summary>
        /// 根据字段描述信息,将行数据转化为字段对应的字符串集合
        /// 根据字段描述的读入起始位置及读取字符数来读取
        /// </summary>
        /// <param name="src">txt行数据</param>
        /// <param name="descCol">字段分割符</param>
        /// <returns>字段对应的字符串集合</returns>
        private List <string> AnalysisTxtLine(string src, List <DataImportDescInfo> descCol)
        {
            StringInfo    s  = new StringInfo(src);
            List <string> sl = new List <string>();

            if (!string.IsNullOrEmpty(src))
            {
                foreach (DataImportDescInfo i in descCol)
                {
                    string t = s.SubString_Byte(i.TxtFieldStartIndex, i.TxtFieldReadLength).ToStringFiltered();
                    sl.Add(t);
                }
            }

            return(sl);
        }