private static bool TryReadQuality(StringSegment input, StringWithQualityHeaderValue result, ref int index) { var current = index; // See if we have a quality value by looking for "q" if ((current == input.Length) || ((input[current] != 'q') && (input[current] != 'Q'))) { return(false); } current++; // skip 'q' identifier current = current + HttpRuleParser.GetWhitespaceLength(input, current); // If we found "q" it must be followed by "=" if ((current == input.Length) || (input[current] != '=')) { return(false); } current++; // skip '=' separator current = current + HttpRuleParser.GetWhitespaceLength(input, current); if (current == input.Length) { return(false); } if (!HeaderUtilities.TryParseQualityDouble(input, current, out var quality, out var qualityLength)) { return(false); } result._quality = quality; current = current + qualityLength; current = current + HttpRuleParser.GetWhitespaceLength(input, current); index = current; return(true); }