org.skyscreamer.yoga.util
Class ParenthesisUtil
java.lang.Object
org.skyscreamer.yoga.util.ParenthesisUtil
public class ParenthesisUtil
- extends Object
Utility for finding nested parentheses
- Author:
- Solomon Duskis , Corby Page , Carter Page
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ParenthesisUtil
public ParenthesisUtil()
getMatchingParenthesisIndex
public static int getMatchingParenthesisIndex(CharSequence selector,
int index)
throws ParseSelectorException
- Given an index of an opening parenthesis "(", find the matching closing parenthesis ")". If there are embedded
parenthesis inside the matching pair, this method will ignore them.
Example:
getMatchingParenthesis("a(b(c))", 1) returns 6
getMatchingParenthesis("a(b(c))", 3) returns 5
- Parameters:
selector - String to analyze for the matching selectorindex - Index of the opening parenthesis to match
- Returns:
- Index of matching closing parenthesis
- Throws:
ParseSelectorException
Copyright © 2012. All Rights Reserved.