码迷,mamicode.com
首页 > 其他好文 > 详细

StringUtil字符串工具类

时间:2018-07-16 11:22:50      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:||   not   pre   public   span   stat   class   null   format   

package com.zjx.util;

/**
 * 字符串工具类
 * @author 
 *
 */
public class StringUtil {

    /**
     * 判断是否是空
     * @param str
     * @return
     */
    public static boolean isEmpty(String str){
        if(str==null||"".equals(str.trim())){
            return true;
        }else{
            return false;
        }
    }
    
    /**
     * 判断是否不是空
     * @param str
     * @return
     */
    public static boolean isNotEmpty(String str){
        if((str!=null)&&!"".equals(str.trim())){
            return true;
        }else{
            return false;
        }
    }
    
    /**
     * 格式化模糊查询
     * @param str
     * @return
     */
    public static String formatLike(String str){
        if(isNotEmpty(str)){
            return "%"+str+"%";
        }else{
            return null;
        }
    }
}

 

StringUtil字符串工具类

标签:||   not   pre   public   span   stat   class   null   format   

原文地址:https://www.cnblogs.com/duanwandao/p/9316074.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!