code: public static String parseString(String inputStr, char startingChar, char endingChar, String key) {
          if (null == inputStr || null == key) {
              return null;
          }
          int matchedStartingIndex = inputStr.indexOf(key + startingChar);
          if (-1 == matchedStartingIndex) {
              return null;
          }
          int matchedEndingIndex = inputStr.indexOf(endingChar, matchedStartingIndex);
          if (-1 == matchedEndingIndex) {
                  return inputStr.substring(matchedStartingIndex + key.length() + 1);
              } else {
                  return inputStr.substring(matchedStartingIndex + key.length() + 1, matchedEndingIndex);
              }
      }
docs: Method which parses the input String to send back the value corresponding to the
  input key. For eg:
  If the inputStr is "TradingPartnerKey=5; OWNER=L3; CBTN=3036240004; RTI=105"
  startingChar is '=', endingChar = ';' & key = "TradingPartnerKey"
  Then the response String will be "5"
  @param inputStr The input String to be parsed
  @param startingChar The first character to be found after the input key
  @param endingChar The first character to be found after the input key-value pair
  @param key For which you need to extract the value
  @return