3023 |
12 Dec 06 |
nicklas |
1 |
/** |
3023 |
12 Dec 06 |
nicklas |
$Id$ |
3023 |
12 Dec 06 |
nicklas |
3 |
|
3675 |
16 Aug 07 |
jari |
Copyright (C) 2006 Nicklas Nordborg |
3023 |
12 Dec 06 |
nicklas |
5 |
|
3023 |
12 Dec 06 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
3023 |
12 Dec 06 |
nicklas |
Available at http://base.thep.lu.se/ |
3023 |
12 Dec 06 |
nicklas |
8 |
|
3023 |
12 Dec 06 |
nicklas |
BASE is free software; you can redistribute it and/or |
3023 |
12 Dec 06 |
nicklas |
modify it under the terms of the GNU General Public License |
4479 |
05 Sep 08 |
jari |
as published by the Free Software Foundation; either version 3 |
3023 |
12 Dec 06 |
nicklas |
of the License, or (at your option) any later version. |
3023 |
12 Dec 06 |
nicklas |
13 |
|
3023 |
12 Dec 06 |
nicklas |
BASE is distributed in the hope that it will be useful, |
3023 |
12 Dec 06 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
3023 |
12 Dec 06 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3023 |
12 Dec 06 |
nicklas |
GNU General Public License for more details. |
3023 |
12 Dec 06 |
nicklas |
18 |
|
3023 |
12 Dec 06 |
nicklas |
You should have received a copy of the GNU General Public License |
4515 |
11 Sep 08 |
jari |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
3023 |
12 Dec 06 |
nicklas |
21 |
*/ |
3023 |
12 Dec 06 |
nicklas |
22 |
package net.sf.basedb.util; |
3023 |
12 Dec 06 |
nicklas |
23 |
|
3023 |
12 Dec 06 |
nicklas |
24 |
import java.text.DecimalFormat; |
3023 |
12 Dec 06 |
nicklas |
25 |
import java.text.DecimalFormatSymbols; |
3023 |
12 Dec 06 |
nicklas |
26 |
|
3023 |
12 Dec 06 |
nicklas |
27 |
/** |
3023 |
12 Dec 06 |
nicklas |
Utility class for working with {@link java.text.NumberFormat} object. |
3023 |
12 Dec 06 |
nicklas |
29 |
|
3023 |
12 Dec 06 |
nicklas |
@author nicklas |
3023 |
12 Dec 06 |
nicklas |
@version 2.2 |
3023 |
12 Dec 06 |
nicklas |
@base.modified $Date$ |
3023 |
12 Dec 06 |
nicklas |
33 |
*/ |
3023 |
12 Dec 06 |
nicklas |
34 |
public class NumberFormatUtil |
3023 |
12 Dec 06 |
nicklas |
35 |
{ |
3023 |
12 Dec 06 |
nicklas |
36 |
|
3023 |
12 Dec 06 |
nicklas |
37 |
public static java.text.NumberFormat |
3023 |
12 Dec 06 |
nicklas |
38 |
getNumberFormat(char decimalSeparator, char groupingSeparator) |
3023 |
12 Dec 06 |
nicklas |
39 |
{ |
3023 |
12 Dec 06 |
nicklas |
40 |
DecimalFormatSymbols sym = new DecimalFormatSymbols(); |
3023 |
12 Dec 06 |
nicklas |
41 |
sym.setDecimalSeparator(decimalSeparator); |
3023 |
12 Dec 06 |
nicklas |
42 |
sym.setGroupingSeparator(groupingSeparator); |
7510 |
01 Nov 18 |
nicklas |
43 |
sym.setExponentSeparator("E"); |
7510 |
01 Nov 18 |
nicklas |
44 |
sym.setMinusSign('-'); |
7658 |
19 Mar 19 |
nicklas |
45 |
DecimalFormat df = new DecimalFormat("0.#################", sym); |
3023 |
12 Dec 06 |
nicklas |
46 |
df.setParseIntegerOnly(false); |
3023 |
12 Dec 06 |
nicklas |
47 |
return df; |
3023 |
12 Dec 06 |
nicklas |
48 |
} |
3023 |
12 Dec 06 |
nicklas |
49 |
|
3023 |
12 Dec 06 |
nicklas |
50 |
} |