Get the inner most String end @param aString The string to be searched for the innermost ( @return inner most String end
(final String aString)
| 211 | * @return inner most String end |
| 212 | */ |
| 213 | public static int innerMostStringEnd(final String aString) |
| 214 | { |
| 215 | int index = 0; |
| 216 | int hi = 0; |
| 217 | int current = 0; |
| 218 | |
| 219 | for (int i = 0; i < aString.length(); ++i) |
| 220 | { |
| 221 | if (aString.charAt(i) == '(') |
| 222 | { |
| 223 | ++current; |
| 224 | |
| 225 | if (current > hi) |
| 226 | { |
| 227 | hi = current; |
| 228 | } |
| 229 | } |
| 230 | else if (aString.charAt(i) == ')') |
| 231 | { |
| 232 | if (current == hi) |
| 233 | { |
| 234 | index = i; |
| 235 | } |
| 236 | |
| 237 | --current; |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | return index; |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Get the innermost String start |
no outgoing calls
no test coverage detected