示例#1
0
        public static Utf8String GetLine(this Utf8String src)
        {
            int pos;

            if (!src.TrySearchAscii((byte)'\n', 0, out pos))
            {
                return(src);
            }

            return(src.Subbytes(0, pos + 1));
        }
示例#2
0
        static JsonTreeNode ParseString(JsonTreeNode tree, Utf8String segment)
        {
            int pos;

            if (segment.TrySearchAscii((Byte)'"', 1, out pos))
            {
                return(tree.AddValue(segment.Subbytes(0, pos + 1).Bytes, ValueNodeType.String));
            }
            else
            {
                throw new ParserException("no close string: " + segment);
            }
        }
示例#3
0
        public JsonPointer(Utf8String pointer) : this()
        {
            int pos;

            if (!pointer.TrySearchAscii((Byte)'/', 0, out pos))
            {
                throw new ArgumentException();
            }
            if (pos != 0)
            {
                throw new ArgumentException();
            }

            var splited = pointer.Split((Byte)'/').ToArray();

            Path = new ArraySegment <Utf8String>(splited, 1, splited.Length - 1);
        }