Buglet - buglet.sourceforge.org

org.buglet.util
Class NumString

java.lang.Object
  |
  +--org.buglet.util.NumString

public class NumString
extends java.lang.Object

This is used for converting Strings containing numbers to various Java number formats.


Constructor Summary
NumString()
           
 
Method Summary
static double fractionToDouble(java.lang.String fraction)
          Converts the String to a double.
static void main(java.lang.String[] args)
          main method, converts the given string to the various number formats, and prints out the results.
static java.lang.String removeNonNumberChars(java.lang.String input)
           
static double todouble(java.lang.Object val)
           
static double todouble(java.lang.String val)
          Converts the String to a double, returning -1 on exception in conversion.
static double todouble(java.lang.String val, double defaultVal)
          Converts the String to a double, returning the defaultval on exception in conversion.
static float tofloat(java.lang.String val)
          Converts the String to a float, returning -1 on exception in conversion.
static float tofloat(java.lang.String val, float defaultVal)
          Converts the String to a float, returning the defaulval on exception in conversion.
static int toint(java.lang.String val)
          Converts the String to an int, returning -1 on exception in conversion.
static int toint(java.lang.String val, int defaultVal)
          Converts the String to an int, returning the defaultval on exception in conversion.
static long tolong(java.lang.String val)
          Converts the String to a long, returning -1 on exception in conversion.
static long tolong(java.lang.String val, long defaultVal)
          Converts the String to a long, returning the defaulval on exception in conversion.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumString

public NumString()
Method Detail

toint

public static int toint(java.lang.String val)
Converts the String to an int, returning -1 on exception in conversion.
Parameters:
val -  

toint

public static int toint(java.lang.String val,
                        int defaultVal)
Converts the String to an int, returning the defaultval on exception in conversion.
Parameters:
val -  
defaultVal -  

tolong

public static long tolong(java.lang.String val)
Converts the String to a long, returning -1 on exception in conversion.
Parameters:
val -  

tolong

public static long tolong(java.lang.String val,
                          long defaultVal)
Converts the String to a long, returning the defaulval on exception in conversion.
Parameters:
val -  
defaultVal -  

tofloat

public static float tofloat(java.lang.String val)
Converts the String to a float, returning -1 on exception in conversion.
Parameters:
val -  

tofloat

public static float tofloat(java.lang.String val,
                            float defaultVal)
Converts the String to a float, returning the defaulval on exception in conversion.
Parameters:
val -  
defaultVal -  

todouble

public static double todouble(java.lang.String val)
Converts the String to a double, returning -1 on exception in conversion.
Parameters:
val -  

todouble

public static double todouble(java.lang.Object val)

todouble

public static double todouble(java.lang.String val,
                              double defaultVal)
Converts the String to a double, returning the defaultval on exception in conversion.
Parameters:
val -  
defaultVal -  

fractionToDouble

public static double fractionToDouble(java.lang.String fraction)
Converts the String to a double. Converts the given fraction to a double, returning -1 on exception in conversion.
Parameters:
fraction -  

removeNonNumberChars

public static java.lang.String removeNonNumberChars(java.lang.String input)

main

public static void main(java.lang.String[] args)
main method, converts the given string to the various number formats, and prints out the results.
Parameters:
args -  

Buglet - buglet.sourceforge.org

Copyright © 2001 58k.com Inc. All Rights Reserved