Class Misc



  • public class Misc
    extends Object
    • Field Detail

      • newline

        public static final String newline
    • Constructor Detail

      • Misc

        public Misc()
    • Method Detail

      • referenceEquals

        public static boolean referenceEquals(Object x,
                                              Object y)
        Makes it clear when a comparison is intended as reference equality.
      • trimOneStartingNewline

        public static String trimOneStartingNewline(String s)
        Strip a single newline character from the front of s.
      • trimOneTrailingNewline

        public static String trimOneTrailingNewline(String s)
        Strip a single newline character from the end of s.
      • stripLastPathElement

        public static String stripLastPathElement(String f)
        Given, say, file:/tmp/test.jar!/org/foo/templates/main.stg convert to file:/tmp/test.jar!/org/foo/templates
      • getFileNameNoSuffix

        public static String getFileNameNoSuffix(String f)
      • getFileName

        public static String getFileName(String fullFileName)
      • replaceEscapes

        public static String replaceEscapes(String s)
      • replaceEscapedRightAngle

        public static String replaceEscapedRightAngle(String s)
        Replace >\> with >> in s. Replace \>> unless prefix of \>>> with >>. Do NOT replace if it's <\\>
      • urlExists

        public static boolean urlExists(URL url)
      • getLineCharPosition

        public static Coordinate getLineCharPosition(String s,
                                                     int index)
        Given index into string s, compute the line and char position in line.