Class Misc

java.lang.Object
org.stringtemplate.v4.misc.Misc

public class Misc extends Object
  • Field Details

    • newline

      public static final String newline
  • Constructor Details

    • Misc

      public Misc()
  • Method Details

    • referenceEquals

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

      public static String join(Iterator<?> iter, String separator)
    • strip

      public static String strip(String s, int n)
    • 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)
    • getParent

      public static String getParent(String name)
    • getPrefix

      public static String getPrefix(String name)
    • replaceEscapes

      public static String replaceEscapes(String s)
    • replaceEscapedRightAngle

      public static String replaceEscapedRightAngle(String s)
      Replace >\> with >> in s.

      Replace \> with > in s, unless prefix of \>>>.

      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.