private static int FindNonWhitespace(byte[] sb, int offset, int length, bool validateOWS) { for (int result = offset; result < length; ++result) { var c = sb[result]; if (!IsWhiteSpace(c)) { return(result); } else if (validateOWS && !IsOWS(c)) { // Only OWS is supported for whitespace ThrowHelper.ThrowArgumentException_Invalid_separator_only_a_single_space_or_horizontal_tab_allowed(c); } } return(length); }