admin
2019-10-10 e19ce4be094d93f68bdb6ee1c28e9caa502bf2c4
utils/src/main/java/org/yeshi/utils/StringUtil.java
@@ -1,13 +1,16 @@
package org.yeshi.utils;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.codec.binary.Base64;
import org.yeshi.utils.encrypt.HmacUtils;
import sun.misc.BASE64Encoder;
@@ -67,7 +70,7 @@
    * @return
    */
   public static boolean isNullOrEmpty(String text) {
      if (text == null || text.length() == 0 || text.equalsIgnoreCase("null")) {
      if (text == null || text.trim().length() == 0 || text.equalsIgnoreCase("null")) {
         return true;
      }
      return false;
@@ -110,6 +113,19 @@
      return null;
   }
   public static String MD5Hmac(String st, String key) {
      try {
         return HmacUtils.byte2hex(HmacUtils.encryptHMAC(st, key));
      } catch (InvalidKeyException e) {
         e.printStackTrace();
      } catch (NoSuchAlgorithmException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      }
      return null;
   }
   /**
    * 将null转为空字符串
    *