예제 #1
0
        public Boolean Parse(out StringSubString key, out StringSubString value)
        {
            Int32 separator_index = FindEqualsSignIndex();

            if (separator_index == -1)
            {
                key   = new StringSubString();
                value = new StringSubString();
                return(false);
            }

            key            = new StringSubString(m_basestring, StartIndex, EndIndex);
            key.StartIndex = StartIndex;
            key.EndIndex   = key.StartIndex + separator_index;
            while (key.Length > 0 && Char.IsWhiteSpace(key[key.Length - 1]) == true)
            {
                --key.EndIndex;
            }

            value            = new StringSubString(m_basestring, StartIndex, EndIndex);
            value.StartIndex = StartIndex + separator_index + 1;
            value.EndIndex   = EndIndex;
            while (value.Length > 0 && Char.IsWhiteSpace(value[0]) == true)
            {
                ++value.StartIndex;
            }
            if (value.Length >= 2 && value[0] == '"' && value[value.Length - 1] == '"')
            {
                ++value.StartIndex; --value.EndIndex;
            }

            return(true);
        }
예제 #2
0
        public Boolean Parse(out StringSubString key, out StringSubString value)
        {
            Int32 separator_index = FindEqualsSignIndex();
            if (separator_index == -1)
            {
                key = new StringSubString();
                value = new StringSubString();
                return false;
            }

            key = new StringSubString(m_basestring, StartIndex, EndIndex);
            key.StartIndex = StartIndex;
            key.EndIndex = key.StartIndex + separator_index;
            while (key.Length > 0 && Char.IsWhiteSpace(key[key.Length - 1]) == true) --key.EndIndex;

            value = new StringSubString(m_basestring, StartIndex, EndIndex);
            value.StartIndex = StartIndex + separator_index + 1;
            value.EndIndex = EndIndex;
            while (value.Length > 0 && Char.IsWhiteSpace(value[0]) == true) ++value.StartIndex;
            if (value.Length >= 2 && value[0] == '"' && value[value.Length - 1] == '"') { ++value.StartIndex; --value.EndIndex; }

            return true;
        }