archonLing
发贴: 57
积分: 10
|
于 2002-12-17 14:35
if the String is a formatted Long, ex: 100,000,000,000, then you could get a DecimalFormat instance with the format first. Then use its
public Number parse(String text) or public Number parse(String text, ParsePosition pos)
methods to get back a Number. Finally, call the longValue() to get back a long.
for example:
long ret = new DecimalFormat("#,##0").parse("100,000,000,000").longValue();
you would need to wrap the code with try..catch block to catch ParseException.
I hope that doesn't confuse you. Heehee...
|