Beispiel #1
0
        public Boolean Parse(out StringBuilderSubString key, out StringBuilderSubString value)
        {
            Int32 separator_index = FindEqualsSignIndex();

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

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

            value            = new StringBuilderSubString(m_basestring);
            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);
        }
Beispiel #2
0
        public static StringBuilderSubString BuildLine(StringBuilder basestring, Int32 startindex)
        {
            if (basestring == null) throw new ArgumentNullException("basestring");
            if (startindex < 0 || startindex >= basestring.Length) throw new ArgumentOutOfRangeException("startindex", "StartIndex must be greater than zero and less than the length of the basestring.");

            StringBuilderSubString substring = new StringBuilderSubString(basestring);
            substring.StartIndex = startindex;
            substring.EndIndex = FindEndlineIndex(basestring, startindex);

            return substring;
        }
Beispiel #3
0
        public static StringBuilderSubString BuildLine(StringBuilder basestring, Int32 startindex)
        {
            if (basestring == null)
            {
                throw new ArgumentNullException("basestring");
            }
            if (startindex < 0 || startindex >= basestring.Length)
            {
                throw new ArgumentOutOfRangeException("startindex", "StartIndex must be greater than zero and less than the length of the basestring.");
            }

            StringBuilderSubString substring = new StringBuilderSubString(basestring);

            substring.StartIndex = startindex;
            substring.EndIndex   = FindEndlineIndex(basestring, startindex);

            return(substring);
        }
Beispiel #4
0
        public Boolean Parse(out StringBuilderSubString key, out StringBuilderSubString value)
        {
            Int32 separator_index = FindEqualsSignIndex();
            if (separator_index == -1)
            {
                key = new StringBuilderSubString();
                value = new StringBuilderSubString();
                return false;
            }

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

            value = new StringBuilderSubString(m_basestring);
            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;
        }