Example #1
0
        /// <summary>
        /// 一直读到某个字符出现或者字符串结束,返回已读取的字符
        /// </summary>
        /// <param name="fixChar"></param>
        /// <returns></returns>
        public string ReadToChar(Char fixChar)
        {
            if (IsEnd() || Current == fixChar)//已到结尾
            {
                return(string.Empty);
            }
            _Buff.Clear();
            do
            {
                //判断当前字符是否等于转义符
                if (Current == '\\')
                {
                    //读取下一个字符
                    if (MoveNext())
                    {
                        if (EscapeFlag_Switch[Current])
                        {
                            _Buff.Append('\\');
                        }
                    }
                    else
                    {//读取失败
                        return(_Buff.ToString());
                    }
                }
                _Buff.Append(Current);                  //将当前字符推入缓冲区
            } while (MoveNext() && Current != fixChar); //读取下一个字符

            return(_Buff.ToString());
        }
Example #2
0
 public string ConvertToJsonString(object obj)
 {
     Buff.Clear();
     AppendObject(obj);
     return(Buff.ToString());
 }