package com.laxture.lib.util;

import java.text.DecimalFormat;

public class NumberUtil {

    public static String format(int num, String pattern) {
        return new DecimalFormat(pattern).format(num);
    }

    public static String format(long num, String pattern) {
        return new DecimalFormat(pattern).format(num);
    }

    public static String format(double num, String pattern) {
        return new DecimalFormat(pattern).format(num);
    }

    public static String format(float num, String pattern) {
        return new DecimalFormat(pattern).format(num);
    }

    public static int parseInt(String text) {
        try {
            return Integer.parseInt(text);
        } catch (Exception ignored) {}
        return 0;
    }

    public static long parseLong(String text) {
        try {
            return Long.parseLong(text);
        } catch (Exception ignored) {}
        return 0;
    }

    public static short parseShort(String text) {
        try {
            return Short.parseShort(text);
        } catch (Exception ignored) {}
        return 0;
    }

    public static byte parseByte(String text) {
        try {
            return Byte.parseByte(text);
        } catch (Exception ignored) {}
        return 0;
    }

    public static float parseFloat(String text) {
        try {
            return Float.parseFloat(text);
        } catch (Exception ignored) {}
        return 0;
    }

    public static double parseDouble(String text) {
        try {
            return Double.parseDouble(text);
        } catch (Exception ignored) {}
        return 0;
    }

}

@@ -626,32 +626,100 @@
 %7B%0A        try %7B%0A
+            if (text.contains(%22.%22)) return (int) parseDouble(text);%0A
             retu
@@ -863,32 +863,101 @@
 %7B%0A        try %7B%0A
+            if (text.contains(%22.%22)) return (long) parseDouble(text);%0A
             retu

Fix parseInt/parseLong