獲取RTF格式字符串中的二進制圖片字符串列表-RTF研究系列

/// <summary>
        /// 獲取RTF格式字符串中的二進制圖片字符串列表
        /// </summary>
        /// <param name="_RtfText">富文本字符串</param>
        /// <returns></returns>
        public static IList<string> GetImageStrList(string _RtfText)
        {
            IList<string> _ImageList = new List<string>();
            while (true)
            {
                int _Index = 0;
                _Index = _RtfText.IndexOf("pichgoal");

                if (_Index == -1) break;
                _RtfText = _RtfText.Remove(0, _Index + 8);

                _Index = _RtfText.IndexOf("\r\n");
                if (_Index > -1)                
                    _RtfText = _RtfText.Remove(0, _Index);
                else
                    break;
                _Index = _RtfText.IndexOf("}");
                _ImageList.Add(_RtfText.Substring(0, _Index).Replace("\r\n", ""));

                _RtfText = _RtfText.Remove(0, _Index);
            }

            return _ImageList;
        }
發佈了19 篇原創文章 · 獲贊 13 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章