Class ArgumentUtil

java.lang.Object
de.chojo.jdautil.parsing.ArgumentUtil

public final class ArgumentUtil extends Object
  • Constructor Details

    • ArgumentUtil

      public ArgumentUtil()
  • Method Details

    • parseQuotedArgs

      public static String[] parseQuotedArgs(String args, boolean strip)
    • parseQuotedArgs

      public static String[] parseQuotedArgs(String[] args)
      Parse arguments and keep quotes together
      Parameters:
      args - args to parse
      Returns:
      parsed args
    • getMessage

      public static String getMessage(String[] strings, int from)
      Get a message from string array from 'from' to array.length().
      Parameters:
      strings - array of strings.
      from - start index (included). Use negative counts to count from the last index.
      Returns:
      array sequence as string
    • getMessage

      public static String getMessage(String[] strings, int from, int to)
      Get a message from string array from 'from' to 'to'.
      Parameters:
      strings - array of strings.
      from - start index (included). Use negative counts to count from the last index.
      to - end index (excluded). Use negative counts to count from the last index.
      Returns:
      array sequence as string
    • getRangeAsList

      public static <T> List<T> getRangeAsList(T[] objects, int from)
      Get a array as sublist from 'from' to array.length().
      Type Parameters:
      T - Type of objects
      Parameters:
      objects - arguments
      from - start index included
      Returns:
      sublist
    • getRangeAsList

      public static <T> List<T> getRangeAsList(T[] objects, int from, int to)
      Get a sublist from array from 'from' to 'to'.
      Type Parameters:
      T - Type of objects
      Parameters:
      objects - list of objects.
      from - start index (included). Use negative counts to count from the last index.
      to - end index (excluded). Use negative counts to count from the last index.
      Returns:
      sublist.
    • getRangeAsList

      public static <T> List<T> getRangeAsList(List<T> objects, int from)
      Get a sublist from 'from' to list.size()
      Type Parameters:
      T - Type of objects
      Parameters:
      objects - list of objects.
      from - start index (included). Use negative counts to count from the last index.
      Returns:
      sublist.
    • getRangeAsList

      public static <T> List<T> getRangeAsList(List<T> objects, int from, int to)
      Get a sublist of a list.
      Type Parameters:
      T - Type of objects
      Parameters:
      objects - list of objects.
      from - start index (included). Use negative counts to count from the last index.
      to - end index (excluded). Use negative counts to count from the last index.
      Returns:
      sublist.