Java String Divide div(String second, String first)

Here you can find the source of div(String second, String first)

Description

div

License

Open Source License

Declaration

private static String div(String second, String first) 

Method Source Code

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

public class Main {
    private static String div(String second, String first) {
        try {/*ww  w . j  av  a  2 s  .  c  om*/
            return String.valueOf(Integer.parseInt(first) / Integer.parseInt(second));
        } catch (NumberFormatException e) {
            try {
                return String.valueOf(Double.parseDouble(first) / Double.parseDouble(second));
            } catch (NumberFormatException e2) {
                throw new IllegalArgumentException(first + " / " + second);
            }
        }
    }
}

Related

  1. div(String content, String extra)
  2. div(String text)
  3. divide(final String s)
  4. divide(Object o1, Object o2, String type)
  5. divide(String m)