private static int findInlineTagDelim ( String inlineText , int searchStart ) { int delimEnd , nestedOpenBrace ; if ( ( delimEnd = inlineText . indexOf ( "}" , searchStart ) ) == - 1 ) { return - 1 ; } else if ( ( ( nestedOpenBrace = inlineText . indexOf ( "{" , searchStart ) ) != - 1 ) && nestedOpenBrace < delimEnd ) { //Found a nested open brace. int nestedCloseBrace = findInlineTagDelim ( inlineText , nestedOpenBrace + 1 ) ; return ( nestedCloseBrace != - 1 ) ? findInlineTagDelim ( inlineText , nestedCloseBrace + 1 ) : - 1 ; } else { return delimEnd ; } }
Recursively find the index of the closing } character for an inline tag and return it . If it can t be found return - 1 .