polyglot.util
Class StringUtil

java.lang.Object
  extended by polyglot.util.StringUtil

public class StringUtil
extends java.lang.Object

String utilities.


Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String escape(char c)
           
static java.lang.String escape(java.lang.String s)
           
static java.lang.String escape(java.lang.String s, boolean unicode)
           
static java.lang.String getFirstComponent(java.lang.String fullName)
           
static java.lang.String getPackageComponent(java.lang.String fullName)
          Given the name for a class, returns the portion which appears to constitute the package -- i.e., all characters up to but not including the last dot, or no characters if the name has no dot.
static java.lang.String getShortNameComponent(java.lang.String fullName)
          Given the name for a class, returns the portion which appears to constitute the package -- i.e., all characters after the last dot, or all the characters if the name has no dot.
static boolean isNameShort(java.lang.String name)
          Returns true iff the provided class name does not appear to be qualified (i.e., it has no dot.)
static java.lang.String nth(int n)
           
static java.lang.String removeFirstComponent(java.lang.String fullName)
           
static java.lang.String unicodeEscape(char c)
           
static java.lang.String unicodeEscape(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

getPackageComponent

public static java.lang.String getPackageComponent(java.lang.String fullName)
Given the name for a class, returns the portion which appears to constitute the package -- i.e., all characters up to but not including the last dot, or no characters if the name has no dot.


getShortNameComponent

public static java.lang.String getShortNameComponent(java.lang.String fullName)
Given the name for a class, returns the portion which appears to constitute the package -- i.e., all characters after the last dot, or all the characters if the name has no dot.


isNameShort

public static boolean isNameShort(java.lang.String name)
Returns true iff the provided class name does not appear to be qualified (i.e., it has no dot.)


getFirstComponent

public static java.lang.String getFirstComponent(java.lang.String fullName)

removeFirstComponent

public static java.lang.String removeFirstComponent(java.lang.String fullName)

escape

public static java.lang.String escape(java.lang.String s)

escape

public static java.lang.String escape(char c)

unicodeEscape

public static java.lang.String unicodeEscape(java.lang.String s)

unicodeEscape

public static java.lang.String unicodeEscape(char c)

escape

public static java.lang.String escape(java.lang.String s,
                                      boolean unicode)

nth

public static java.lang.String nth(int n)