All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tw.edu.ncnu.im.cnclab.Tools.StringTool

java.lang.Object
   |
   +----tw.edu.ncnu.im.cnclab.Tools.StringTool

public class StringTool
extends Object
The StringTool class provides some method of String processing.

Version:
0.4 Jul 8, 1999
Author:
Ding-Yi Chen

Method Index

 o doubleToString(double, int)
Translate double to String.
 o doubleToString(double, int, int)
Translate double to String.
 o getSimpleClassName(Class)
Get the simple name of the class.
 o getSimpleClassName(String)
Get the simple name of the class.
 o longToString(long, int)
Translate long int to String.

Methods

 o longToString
 public static String longToString(long l,
                                   int len)
Translate long int to String.

Parameters:
l - The long int to translate.
len - Specifies the length of the String.
Returns:
The result String.
 o doubleToString
 public static String doubleToString(double d,
                                     int precision)
Translate double to String.

Parameters:
d - The double to translate.
precision - Specifies the number of digits to appear after the decimal point.
Returns:
The result String.
 o doubleToString
 public static String doubleToString(double d,
                                     int precision,
                                     int len)
Translate double to String.

Note:

If the length of translated string greater than len , the tail of the String will be truncated and replaced by '~' .

If the length of string less than len it will be blank-padded on the left of the String.

Examples

 o getSimpleClassName
 public static String getSimpleClassName(Class theClass)
Get the simple name of the class.

If the class is java.lang.Object , then return the simple name "Object" .

Parameters:
theClass - The Class.
Returns:
the simple name.
 o getSimpleClassName
 public static String getSimpleClassName(String str)
Get the simple name of the class.

If the class is java.lang.Object , then return the simple name "Object" .

Parameters:
str - The fully-qualified name.
Returns:
the simple name.

All Packages  Class Hierarchy  This Package  Previous  Next  Index