mirror of
https://github.com/TeamNewPipe/NewPipeExtractor
synced 2024-12-14 04:49:34 +01:00
Remove length check from StringUtils.matchToClosingParenthesis
This commit is contained in:
parent
852a65ff18
commit
37df225556
@ -9,10 +9,11 @@ public class StringUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string The string to search in
|
* @param string The string to search in.
|
||||||
* @param start A string from which to start searching.
|
* @param start A string from which to start searching.
|
||||||
* @return A substring where each '{' matches a '}'
|
* @return A substring where each '{' matches a '}'.
|
||||||
* @throws IndexOutOfBoundsException If {@code string} does not contain {@code start}
|
* @throws IndexOutOfBoundsException If {@code string} does not contain {@code start}
|
||||||
|
* or parenthesis could not be matched .
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static String matchToClosingParenthesis(@Nonnull final String string, @Nonnull final String start) {
|
public static String matchToClosingParenthesis(@Nonnull final String string, @Nonnull final String start) {
|
||||||
@ -29,8 +30,7 @@ public class StringUtils {
|
|||||||
++endIndex;
|
++endIndex;
|
||||||
|
|
||||||
int openParenthesis = 1;
|
int openParenthesis = 1;
|
||||||
int length = string.length();
|
while (openParenthesis > 0) {
|
||||||
while (openParenthesis > 0 && endIndex < length) {
|
|
||||||
switch (string.charAt(endIndex)) {
|
switch (string.charAt(endIndex)) {
|
||||||
case '{':
|
case '{':
|
||||||
++openParenthesis;
|
++openParenthesis;
|
||||||
|
Loading…
Reference in New Issue
Block a user