src/main/java/com/sulei/util/StringUtils.java

(开头部分) 13KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.sulei.util;

import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

/**
 * 字符串操作工具类
 * 
 * @author NEC
 * @version 1.0.0 2013-12-06
 *
 */
public class StringUtils {

    /**
     * 比较两个字符串是否相等,null和“”等同
     * 
     * @param strA String
     * @param strB String
     * @return boolean (true:相等 false:不相等)
     */
    public static boolean equals(String strA, String strB) {
        if (strA == null || strA.length() == 0) {
            if (strB == null || strB.length() == 0) {
                return true;
            }
            return false;
        }

        return strA.equals(strB);
    }

    /**
     * 判断字符串是否为null或是长度为0
     * 
     * @param str String 字符串
     * @return boolean (true:是  false:否)
     */
    public static boolean isEmptyOrNull(String str) {
        return Boolean.valueOf(str == null || str.replace(' ',' ').trim().length() == 0);
    }

    /**
     * 将传入的字符串数组中的所有字符串依次连接成一个字符串并返回
     * 
     * @param strs 要连接的字符串数组
     * @return 连接后的字符串
     */
    public static String concatStrings(String... strs) {
        if (strs == null || strs.length == 0) {
            return null;
        }

        StringBuffer sb = new StringBuffer();
        for (String str : strs) {
            sb.append(str);
        }

后面还有 393 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。