This method removes parenthesis from start of the given string.
It removes also the associated closing parenthesis.
357837
protected function removeParenthesisFromStart($token) {
        $parenthesisRemoved = 0;

        $trim = trim($token);
        if ($trim !== '' && $trim[0] === '(') { // remove only one parenthesis pair now!
            $parenthesisRemoved++;
            $trim[0] = ' ';
            $trim = trim($trim);
        }

        $parenthesis = $parenthesisRemoved;
        $i = 0;
        $string = 0;
        // Whether a string was opened or not, and with which character it was open (' or ")
        $stringOpened = '';
        while ($i < strlen($trim)) {

            if ($trim[$i] === "\\") {
                $i += 2; // an escape character, the next character is irrelevant
                continue;
            }

            if ($trim[$i] === "'") {
                if ($stringOpened === '') {
                    $stringOpened = "'";
                } elseif ($stringOpened === "'") {
                    $stringOpened = '';
                }
            }

            if ($trim[$i] === '"') {
                if ($stringOpened === '') {
                    $stringOpened = '"';
                } elseif ($stringOpened === '"') {
                    $stringOpened = '';
                }
            }

            if (($stringOpened === '') && ($trim[$i] === '(')) {
                $parenthesis++;
            }

            if (($stringOpened === '') && ($trim[$i] === ')')) {
                if ($parenthesis == $parenthesisRemoved) {
                    $trim[$i] = ' ';
                    $parenthesisRemoved--;
                }
                $parenthesis--;
            }
            $i++;
        }
        return trim($trim);
    }
624930
public static String trim(String value) {
    int start;
    int end;
    final int lengthMinusOne = value.length() - 1;
    for (start = 0; start <= lengthMinusOne; ++start) {
      if (!isSpace(value.charAt(start))) {
        break;
      }
    }
    for (end = lengthMinusOne; end >= start; --end) {
      if (!isSpace(value.charAt(end))) {
        break;
      }
    }
    if (start == 0 && end == lengthMinusOne) {
      return value;
    }
    if (start > lengthMinusOne) {
      return "";
    }
    return value.substring(start, end + 1);
  }
1326008
def remove_parenthesis_around_tz(cls, timestr):
        
        parenthesis = cls.TIMEZONE_PARENTHESIS.match(timestr)
        if parenthesis is not None:
            return parenthesis.group(1)
792709
protected String trim(String s) {
        if (s == null || s.length() == 0)
            return s;

        return s.trim();
    }
57968
public String trimLeading(String str) {
        if (str == null) {
            return null;
        }

        int length = str.length();
        for (int i=0; i<length; i++) {
            if (str.charAt(i) > ' ') {
                return str.substring(i);
            }
        }

        return "";
    }
1125026
public JSPStrBuffer replace(int start, int end, String string) {
		sb.replace(start, end, string);
		return this;
	}
897855
private String removeExtension(String string) {
		String pathWithoutExtension = string;
		int dotIndex = string.lastIndexOf('.');
		if (dotIndex > 0) {
			pathWithoutExtension = string.substring(0, dotIndex);
		}
		return pathWithoutExtension;
	}
1350148
String trim(String string) {
        BaseFont ft = font.getFont();
        if (ft.getFontType() == BaseFont.FONT_TYPE_CJK && ft.getUnicodeEquivalent(' ') != ' ') {
            while (string.endsWith("\u0001")) {
                string = string.substring(0, string.length() - 1);
            }
        }
        else {
            while (string.endsWith(" ") || string.endsWith("\t")) {
                string = string.substring(0, string.length() - 1);
            }
        }
        return string;
    }
1201258
private void parse(String text, int start, int end)
   {
      int closing = getClosingParenthesisPosition(text, start);
      if (closing == -1 || closing > end)
      {
         throw new IllegalStateException("Error in parenthesis hierarchy");
      }
      if (!text.startsWith("(0||"))
      {
         throw new IllegalStateException("Not a valid record");
      }

      int valueStart = getNextOpeningParenthesisPosition(text, start);
      int valueStop = getClosingParenthesisPosition(text, valueStart);
      int dictStart = getNextOpeningParenthesisPosition(text, valueStop);
      int dictStop = getClosingParenthesisPosition(text, dictStart);
      parse(text, start + 4, valueStart, valueStop, dictStart, dictStop);
   }
900464
function removePrefix(str, prefixToken) {
  const index =  str.indexOf(prefixToken);

  if (index > -1) {
    str = str.substr(index + prefixToken.length).trim();
  }
  return str;
}
455506
public static boolean startsWith(String str, char prefix) {
	return str != null && str.length() > 0 && str.charAt(0) == prefix;
    }
687351
def _mid(string, start, end=None):
    
    if end is None:
        end = len(string)
    return string[start:start + end]
94632
private String trimTo1(String string) {

		while (string.startsWith("\"\"") && string.endsWith("\"\"")) {

			string = string.substring(1, string.length() - 1);
		}
		return string;
	}
1170533
protected AstNode removeParens(AstNode node) {
        while (node instanceof ParenthesizedExpression) {
            node = ((ParenthesizedExpression)node).getExpression();
        }
        return node;
    }
749435
public void removeString(String str)
    {
        if (sourceNode != null)
        {
            //Split the _transition path corresponding to str to ensure that
            //any other _transition paths sharing nodes with it are not affected
            splitTransitionPath(sourceNode, str);

            //Remove from equivalenceClassMDAGNodeHashMap, the entries of all the nodes in the _transition path corresponding to str.
            removeTransitionPathRegisterEntries(str);

            //Get the last node in the _transition path corresponding to str
            MDAGNode strEndNode = sourceNode.transition(str);
            if (strEndNode == null) return;

            if (!strEndNode.hasTransitions())
            {
                int soleInternalTransitionPathLength = calculateSoleTransitionPathLength(str);
                int internalTransitionPathLength = str.length() - 1;

                if (soleInternalTransitionPathLength == internalTransitionPathLength)
                {
                    sourceNode.removeOutgoingTransition(str.charAt(0));
                    transitionCount -= str.length();
                }
                else
                {
                    //Remove the sub-path in str's _transition path that is only used by str
                    int toBeRemovedTransitionLabelCharIndex = (internalTransitionPathLength - soleInternalTransitionPathLength);
                    MDAGNode latestNonSoloTransitionPathNode = sourceNode.transition(str.substring(0, toBeRemovedTransitionLabelCharIndex));
                    latestNonSoloTransitionPathNode.removeOutgoingTransition(str.charAt(toBeRemovedTransitionLabelCharIndex));
                    transitionCount -= str.substring(toBeRemovedTransitionLabelCharIndex).length();
                    /////

                    replaceOrRegister(sourceNode, str.substring(0, toBeRemovedTransitionLabelCharIndex));
                }

            }
            else
            {
                strEndNode.setAcceptStateStatus(false);
                replaceOrRegister(sourceNode, str);
            }
        }
        else
        {
            unSimplify();
        }
    }
788429
private String removeBeginningAt(final String input,
            final String searchString) {
        final int i = input.indexOf(searchString);
        if (i != -1) {
            return input.substring(i + 1, input.length());
        }
        return input;
    }
494806
public String remove(String expression) {
    if (expression == null || expression.length() == 0) { return null; }
    String property = next(expression);
    if (expression.length() == property.length()) { return null; }
    int start = property.length();
    if (expression.charAt(start) == Nested) start++;
    return expression.substring(start);
  }