BTDB.StreamLayer.AbstractBufferedWriter.WriteStringOrdered C# (CSharp) Method

WriteStringOrdered() public method

public WriteStringOrdered ( string value ) : void
value string
return void
        public void WriteStringOrdered(string value)
        {
            if (value == null)
            {
                WriteVUInt32(0x110001);
                return;
            }
            var l = value.Length;
            int i = 0;
            while (i < l)
            {
                var c = value[i];
                if (char.IsHighSurrogate(c) && i + 1 < l)
                {
                    var c2 = value[i + 1];
                    if (char.IsLowSurrogate(c2))
                    {
                        WriteVUInt32((uint)((c - 0xD800) * 0x400 + (c2 - 0xDC00) + 0x10000) + 1);
                        i += 2;
                        continue;
                    }
                }
                WriteVUInt32((uint)c + 1);
                i++;
            }
            WriteByteZero();
        }