Class TextUtil


  • public class TextUtil
    extends Object
    Created by The eXo Platform SAS.
    Version:
    $Id: PutCommand.java 12004 2007-01-17 12:03:57Z geaz $
    Author:
    Vitaly Guly - gavrikvetal@gmail.com
    • Field Detail

      • URISave

        public static BitSet URISave
      • URISaveEx

        public static BitSet URISaveEx
      • hexTable

        public static final char[] hexTable
        Hexademical characters.
    • Constructor Detail

      • TextUtil

        public TextUtil()
    • Method Detail

      • unescape

        public static String unescape​(String string,
                                      char escape)
        Unescapes string using escape symbol.
        Parameters:
        string - string
        escape - escape symbol
        Returns:
        unescaped string
      • escape

        public static String escape​(String string,
                                    char escape,
                                    boolean isPath)
        Escapes string using escape symbol.
        Parameters:
        string - string
        escape - escape symbol
        isPath - if the string is path
        Returns:
        escaped string
      • relativizePath

        public static String relativizePath​(String path)
        Creates relative path from string.
        Parameters:
        path - path
        Returns:
        relative path
      • relativizePath

        public static String relativizePath​(String path,
                                            boolean withIndex)
        Creates relative path from string.
        Parameters:
        path - path
        withIndex - indicates whether we should keep the index or not
        Returns:
        relative path
      • removeIndexFromPath

        public static String removeIndexFromPath​(String path)
        Removes the index from the path if it has an index defined
      • pathOnly

        public static String pathOnly​(String path)
        Cuts the path from string.
        Parameters:
        path - full path
        Returns:
        relative path.
      • parentPath

        public static String parentPath​(String path)
        Parameters:
        path - path
        Returns:
        parentPath
      • nameOnly

        public static String nameOnly​(String path)
        Cuts the current name from the path.
        Parameters:
        path - path
        Returns:
        current name
      • isMediaFile

        public static boolean isMediaFile​(String mimeType)
        Checks if Mime-Type is media mime type.
        Parameters:
        mimeType - Mime-Type
        Returns:
        true if is media false if not.
      • getExtension

        public static String getExtension​(String filename)
        Extracts the extension of the file.
        Parameters:
        filename - file name
        Returns:
        extension or emtpy string if file has no extension