Class Utilities

java.lang.Object
com.github.rhys_h_walker.misc.Utilities

public class Utilities extends Object
A class of general purpose utilities
  • Method Details

    • removeLeadingZeros

      public static String removeLeadingZeros(String toRemove)
      Remove all leading zeros from a String
      Parameters:
      toRemove - The String to have zeros removed
      Returns:
      The String without zeros
    • formatFilepathFromTimestamp

      public static String formatFilepathFromTimestamp(LocalDateTime ts, File applicationDirectory)
      Create a path from a timestamp and app directory
      Parameters:
      ts - Timestamp to format fileString from
      applicationDirectory - The directory to begin searching from
      Returns:
      String representing the path to a .log file
    • cleanFileNameString

      public static String cleanFileNameString(String filename)
      Clean a non empty String for use as a filename REGEX USED = INVALID_FILENAME_CHARS_REGEX *Check Utilities.java* Trailing dots and spaces removed File name size limit imposed 100 chars On error no alternative name will be given
      Parameters:
      filename - The filename to clean
      Returns:
      A cleaned version/null if errored