im.yixin.sdk.util
类 StringUtil

java.lang.Object
  继承者 im.yixin.sdk.util.StringUtil

public class StringUtil
extends java.lang.Object

字符串工具类


构造方法摘要
StringUtil()
           
 
方法摘要
static java.lang.String CR2Blank(java.lang.String src)
          换行替换成空格
static android.os.Bundle decodeUrl(java.lang.String s)
           
static boolean isBlank(java.lang.CharSequence cs)
           Checks if a CharSequence is whitespace, empty ("") or null.
static boolean isNotBlank(java.lang.CharSequence cs)
           Checks if a CharSequence is not empty (""), not null and not whitespace only.
static android.os.Bundle parseUrl(java.lang.String url)
           
static java.lang.String substringByByteCount(java.lang.String str, int byteCount, boolean needDots)
          取count个字节,中文为2个字节,英文为1个字节。
static java.lang.String substringByCharCount(java.lang.String str, int charCount, boolean needDots)
          取count个char字符。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

StringUtil

public StringUtil()
方法详细信息

isBlank

public static boolean isBlank(java.lang.CharSequence cs)

Checks if a CharSequence is whitespace, empty ("") or null.

 StringUtils.isBlank(null)      = true
 StringUtils.isBlank("")        = true
 StringUtils.isBlank(" ")       = true
 StringUtils.isBlank("bob")     = false
 StringUtils.isBlank("  bob  ") = false
 

参数:
cs - the CharSequence to check, may be null
返回:
true if the CharSequence is null, empty or whitespace

isNotBlank

public static boolean isNotBlank(java.lang.CharSequence cs)

Checks if a CharSequence is not empty (""), not null and not whitespace only.

 StringUtils.isNotBlank(null)      = false
 StringUtils.isNotBlank("")        = false
 StringUtils.isNotBlank(" ")       = false
 StringUtils.isNotBlank("bob")     = true
 StringUtils.isNotBlank("  bob  ") = true
 

参数:
cs - the CharSequence to check, may be null
返回:
true if the CharSequence is not empty and not null and not whitespace
从以下版本开始:
2.0, 3.0 Changed signature from isNotBlank(String) to isNotBlank(CharSequence)

substringByByteCount

public static java.lang.String substringByByteCount(java.lang.String str,
                                                    int byteCount,
                                                    boolean needDots)
取count个字节,中文为2个字节,英文为1个字节。前面是英文奇数字节数、最后一个是中文时被忽略。
"a中aaa中aaa","aaa中aaaaa","中a中中中中中中"

参数:
str - 被处理字符串
byteCount - 截取字节数
needDots - 在字节数超过时是否加省略号

substringByCharCount

public static java.lang.String substringByCharCount(java.lang.String str,
                                                    int charCount,
                                                    boolean needDots)
取count个char字符。中文、英文都为1个char

参数:
str - 被处理字符串
needDots - 在字节数超过时是否加省略号

CR2Blank

public static java.lang.String CR2Blank(java.lang.String src)
换行替换成空格

参数:
src - 源字符串
返回:
转换后字符串

parseUrl

public static android.os.Bundle parseUrl(java.lang.String url)

decodeUrl

public static android.os.Bundle decodeUrl(java.lang.String s)