Class StringParserUtils

java.lang.Object
edu.university.ecs.lab.intermediate.utils.StringParserUtils

public class StringParserUtils extends Object
Utility class for parsing strings.
  • Method Details

    • removeOuterQuotations

      public static String removeOuterQuotations(String s)
      Remove start/end quotations from the given string.

      ex: "abcde" --> abcde

      Parameters:
      s - the string to remove quotations from
      Returns:
      the string with quotations removed
    • mergePaths

      public static String mergePaths(String classPath, String methodPath)
      Merge the given class and method paths into a single path.

      ex: /abc/def and ghi/jkl --> abc/def/ghi/jkl

      Parameters:
      classPath - the class base (api) path
      methodPath - the method (api) path
      Returns:
      the merged path
    • findPackage

      public static String findPackage(com.github.javaparser.ast.CompilationUnit cu)
      Find the package name in the given compilation unit.
      Parameters:
      cu - the compilation unit
      Returns:
      the package name else null if not found
    • simplifyEndpointURL

      public static String simplifyEndpointURL(String url)
      Simplifies all path arguments to {?}.
      Parameters:
      url - the endpoint URL
      Returns:
      the simplified endpoint URL