Android String to Float Convert String2AmountFloat(String str)

Here you can find the source of String2AmountFloat(String str)

Description

String Amount Float

Declaration

public static double String2AmountFloat(String str) 

Method Source Code

//package com.java2s;

import java.text.NumberFormat;

public class Main {
    public static double String2AmountFloat(String str) {
        try {//from w w  w.j  a  v  a2 s . c  o m
            String tempStr = NumberFormat.getNumberInstance()
                    .format(Long.parseLong(str, 10)).replace(",", "");
            return Long.parseLong(tempStr) / 100.00;
        } catch (Exception e) {
            e.printStackTrace();
            return 0.00;
        }
    }
}

Related

  1. isFloat(String str)
  2. isFloat(String str, int precision)
  3. getFloatValue(double val, int len)
  4. parseFloat(String string, float defValue)