Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.text.TextUtils;

import java.text.NumberFormat;
import java.text.ParseException;

public class Main {
    public static double getAmount(String amountStr) {
        if (TextUtils.isEmpty(amountStr))
            return 0;
        else {
            if (amountStr.startsWith("+"))
                amountStr = amountStr.substring(1);
            try {
                return NumberFormat.getInstance().parse(amountStr).doubleValue();
            } catch (ParseException e) {
                return 0;
            }
        }
    }
}