Class StringUtils


  • public class StringUtils
    extends Object
    Some simple string utilities
    Author:
    markr
    • Constructor Detail

      • StringUtils

        public StringUtils()
    • Method Detail

      • splitByAnythingExceptAlphaNumeric

        public static String[] splitByAnythingExceptAlphaNumeric​(String toSplit)
        split string by anything but alpha numeric characters, i.e., a-zA-Z0-9
        Parameters:
        toSplit - string to split
        Returns:
        split string
      • isNullOrBlank

        public static boolean isNullOrBlank​(String string)
        Verify if null or blank
        Parameters:
        string - to verify
        Returns:
        true when null or blank
      • removeInitialStringWhenPresent

        public static String removeInitialStringWhenPresent​(String theString,
                                                            String initialString)
        Remove the given string from the beginning of the string if present and return result
        Parameters:
        theString - to alter
        initialString - to remove if present
        Returns:
        altered string
      • removeEndingStringWhenPresent

        public static String removeEndingStringWhenPresent​(String theString,
                                                           String endString)
        Remove the given string from the end of the string if present and return result
        Parameters:
        theString - to alter
        endString - to remove if present
        Returns:
        altered string