code: public static String substring(final String pSource, final String pBeginBoundaryString, final String pEndBoundaryString,
                                     final int pOffset) {
          // Check offset
          int offset = (pOffset < 0)
                  ? 0
                  : pOffset;
  
          // Find the start index
          int startIndex = pSource.indexOf(pBeginBoundaryString, offset) + pBeginBoundaryString.length();
  
          if (startIndex < 0) {
              return null;
          }
  
          // Find the end index
          int endIndex = pSource.indexOf(pEndBoundaryString, startIndex);
  
          if (endIndex < 0) {
              return null;
          }
          return pSource.substring(startIndex, endIndex);
      }
docs: Gets the first substring between the given string boundaries.
  <p/>
  
  @param pSource              The source string.
  @param pBeginBoundaryString The string that marks the beginning.
  @param pEndBoundaryString   The string that marks the end.
  @param pOffset              The index to start searching in the source
  string. If it is less than 0, the index will be set to 0.
  @return the substring demarcated by the given string boundaries or null
  if not both string boundaries are found.