private static string ExpectString(string input, ref int inputIndex, char startChar, char endChar) { if (input[inputIndex] != startChar) { throw new FormatException(DiagnosticMessages.DataRow_FromString_ExpectChar(startChar, input.Substring(0, inputIndex))); } inputIndex++; return(ExpectString(input, ref inputIndex, endChar)); }
private static string ExpectString(string input, ref int inputIndex, char endChar) { var startIndex = inputIndex; while (inputIndex < input.Length && input[inputIndex] != endChar) { inputIndex++; } if (inputIndex == input.Length) { throw new FormatException(DiagnosticMessages.DataRow_FromString_ExpectChar(endChar, input.Substring(0, startIndex))); } var result = input.Substring(startIndex, inputIndex - startIndex); inputIndex++; return(result); }