maslab.util
Class StringUtil

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

public class StringUtil
extends java.lang.Object

Various useful functions for strings.


Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String formatDouble(double d, int decimalPlaces)
           
static java.lang.String formatHex(long l, int digits)
           
static void main(java.lang.String[] args)
           
static java.lang.String padLeft(java.lang.String in, int length, char c)
          Pad a string with characters on the left.
static java.lang.String padRight(java.lang.String in, int length, char c)
          Pad a string with characters on the right.
static double parseDouble(java.lang.String in)
          Parse a number of the format XXXXX(.YYYY)?
static java.lang.String[] split(java.lang.String in, java.lang.String delim)
          Encapsulates the functionality of StringTokenizer in semantics that look more like String.split(), a function that is only available in Java 1.4.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

padLeft

public static java.lang.String padLeft(java.lang.String in,
                                       int length,
                                       char c)
Pad a string with characters on the left.

Parameters:
in - The string to pad
length - The desired final length of the string.
Returns:
The padded string. If the string was already length bytes long, the original string is returned.

padRight

public static java.lang.String padRight(java.lang.String in,
                                        int length,
                                        char c)
Pad a string with characters on the right.

Parameters:
in - The string to pad
length - The desired final length of the string.
Returns:
The padded string. If the string was already length bytes long, the original string is returned.

split

public static java.lang.String[] split(java.lang.String in,
                                       java.lang.String delim)
Encapsulates the functionality of StringTokenizer in semantics that look more like String.split(), a function that is only available in Java 1.4.

Parameters:
in - The string you want to split.
delim - The set of characters to use as delimiters.
Returns:
The split pieces of the original string.

formatDouble

public static java.lang.String formatDouble(double d,
                                            int decimalPlaces)

parseDouble

public static double parseDouble(java.lang.String in)
Parse a number of the format XXXXX(.YYYY)?


formatHex

public static java.lang.String formatHex(long l,
                                         int digits)

main

public static void main(java.lang.String[] args)