文字列の比較

来源:互联网 发布:js上传图片跨域问题 编辑:程序博客网 时间:2024/05/14 01:29

    /**
     * 文字列の比較
     * @param str1 文字列
     * @param str2 文字列
     * @return true:相等 false:比相等
     */
    public static boolean equalStr(String str1, String str2) {
        if (str1 == null) {
            if (str2 == null) {
                return true;
            } else
                return false;
        } else
            return str1.equals(str2);
    }