src/Misc/EFTools/EntityDesign/Refactoring/VsObjectSearchResults.cs
// <summary>
//     Parses out the line and column number from text, given line and column number formatting of "... (x,y)" where x is the line number
//     and y is the column number.
// </summary>
Parses out the line and column number from text, given line and column number formatting of "... (x,y)" where x is the line number
and y is the column number.
Parses out the line and column number from text given line and column number formatting of " ... ( x y ) " where x is the line number and y is the column number .
private static bool TryParseLineAndColumn(string text, int endLastIndexCount, out int lineNumber, out int columnNumber)
        {
            lineNumber = 0;
            columnNumber = 0;
            var startParenIndex = text.LastIndexOf("(", endLastIndexCount, endLastIndexCount, StringComparison.Ordinal);
            var commaIndex = text.LastIndexOf(",", endLastIndexCount, endLastIndexCount, StringComparison.Ordinal);
            var endParenIndex = text.LastIndexOf(")", endLastIndexCount, endLastIndexCount, StringComparison.Ordinal);
            if (startParenIndex > 0
                && commaIndex > 0
                && endParenIndex > 0
                &&
                int.TryParse(text.Substring(startParenIndex + 1, commaIndex - (startParenIndex + 1)), out lineNumber)
                &&
                int.TryParse(text.Substring(commaIndex + 1, endParenIndex - (commaIndex + 1)), out columnNumber))
            {
                return true;
            }
            return false;
        }
private static bool TryParseLineAndColumn ( string text , int endLastIndexCount , out int lineNumber , out int columnNumber ) { lineNumber = 0 ; columnNumber = 0 ; var startParenIndex = text . LastIndexOf ( " " , endLastIndexCount , endLastIndexCount , StringComparison . Ordinal ) ; var commaIndex = text . LastIndexOf ( " " , endLastIndexCount , endLastIndexCount , StringComparison . Ordinal ) ; var endParenIndex = text . LastIndexOf ( " " , endLastIndexCount , endLastIndexCount , StringComparison . Ordinal ) ; if ( startParenIndex > 0 && commaIndex > 0 && endParenIndex > 0 && int . TryParse ( text . Substring ( startParenIndex + 1 , commaIndex - ( startParenIndex + 1 ) ) , out lineNumber ) && int . TryParse ( text . Substring ( commaIndex + 1 , endParenIndex - ( commaIndex + 1 ) ) , out columnNumber ) ) { return true ; } return false ; }
Parses out the line and column number from text, given line and column number formatting of "... (x,y)" where x is the line number
and y is the column number.
Parses out the line and column number from text given line and column number formatting of " ... ( x y ) " where x is the line number and y is the column number .
text
string
endLastIndexCount
int
int
out