1
2
3
4
5
6
7
8
9
10
11
12
|
private String makeDecimal(String str) {
String result;
String cleanString = str.replaceAll("[-+.]", "");
if(str.equals("0")){
result = "0.0";
}
else {
BigDecimal bigDecimal = new BigDecimal(cleanString).setScale(2, BigDecimal.ROUND_FLOOR).divide(new BigDecimal(10), BigDecimal.ROUND_FLOOR);
result = NumberFormat.getNumberInstance().format(bigDecimal).replaceAll("[,]", "");
}
return result;
}
|
cs |
'Android' 카테고리의 다른 글
레이아웃과 포커싱 (0) | 2021.01.20 |
---|---|
단말기 하드키 조작과 listview focusing (0) | 2021.01.07 |
How to get a decimal point using EditText TextWatcher (0) | 2020.12.18 |
AES128 암호화 (0) | 2020.12.18 |
Data Retrieving for the stored data in SharedPreferences either through ShPrefs or XML Parser (0) | 2020.10.05 |
댓글