Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static boolean isInt(Object srcStr) {
        // return null == srcStr || srcStr.equals("null");
        if (srcStr == null) {
            return false;
        }
        String s = srcStr.toString().replaceAll("(\\s)", "");
        Pattern p = Pattern.compile("([-]?[\\d]+)");
        Matcher m = p.matcher(s);
        return m.matches();
        // return nvl(srcStr, "").trim().length() == 0 || nvl(srcStr,
        // "").equals("null");
    }

    public static String toString(Object obj) {
        if (null == obj) {
            return "";
        }

        return obj.toString();
    }

    public static String toString(Object obj, String defaultStr) {
        if (null == obj) {
            return defaultStr;
        }

        return obj.toString();
    }
}