| 构造器 | 说明 |
|---|---|
UtilString() |
| 修饰符和类型 | 方法 | 说明 |
|---|---|---|
static String |
capFirst(String str) |
|
static Object |
createObjectFromParams(String params,
String thingPath,
ActionContext actionContext) |
|
static Object |
createObjectFromParams(Map<String,?> values,
String thingPath,
ActionContext actionContext) |
|
static void |
debug(ActionContext context,
Object obj) |
|
static boolean |
eq(Thing thing,
String attributeName,
String value) |
返回字符串是否相等,如果属性值为null也返回false。
|
static String[] |
getGroovyStringArray(String str) |
解析使用Groovy方式定义的字符串数组,如["cb", "cb"] as String[]。
|
static int |
getInt(String str) |
|
static Map<String,String> |
getParams(String str) |
解码参数字符串,分隔符默认为&,默认编码utf-8,过滤引号。
|
static Map<String,String> |
getParams(String str,
String splitStr) |
解码参数字符串,默认编码utf-8,过滤引号。
|
static Map<String,String> |
getParams(String str,
String splitStr,
String encoding) |
解码参数字符串,过滤引号。
|
static Map<String,String> |
getParams(String str,
String splitStr,
String encoding,
boolean trimQuotate) |
解码参数字符串。
|
static String |
getSizeInfo(double size) |
|
static String |
getString(String value,
ActionContext actionContext) |
从制定的字符串值中读取字符串。
|
static String |
getString(Thing thing,
String attribute,
ActionContext actionContext) |
从事物取指定的属性的字符串值,然后从actionContext中取可能的值。
|
static String[] |
getStringArray(String strArray) |
|
static String |
getThingManagerFileName(Thing thing) |
|
static boolean |
haveDescriptor(String descriptors,
String descriptor) |
判断描述者列表字符串中是否包含描述者。
|
static byte[] |
hexStringToByteArray(String hex) |
将"00 01 02"形式的字符串转成byte[]
|
static String |
insert(String source,
String forInsert,
int index) |
插入一个指定字符串至源字符串中,源字符串中用,号隔开的。
|
static boolean |
isNotNull(String str) |
|
static boolean |
isNull(String str) |
|
static boolean |
isNull(Thing thing,
String attributeName) |
返回指定的事物的属性是否为空,如果是字符串那么null和""都返回true。
|
static String[] |
split(String str,
char ch) |
分割字符串的方法非String实现,稍微快一些。
|
static char |
toHex(int nibble) |
|
static String |
toHexString(byte[] bytes) |
|
static int[] |
toIntArray(String intArray) |
|
static String |
toUnicode(String theString,
boolean escapeSpace) |
|
static String |
trimFileName(String str) |
返回一个正常的文件名,把/\.?
|
static String |
uncapFirst(String str) |
让字符串的第一个字母小写。
|
public static String[] getGroovyStringArray(String str)
str - 字符串public static boolean eq(Thing thing, String attributeName, String value)
thing - 事物attributeName - 属性名value - 值public static boolean isNull(Thing thing, String attributeName)
thing - 事物attributeName - 属性名public static String[] split(String str, char ch)
str - 字符串ch - 分给符public static boolean haveDescriptor(String descriptors, String descriptor)
descriptors - 描述者列表descriptor - 描述者public static String insert(String source, String forInsert, int index)
source - 源字符串forInsert - 需要插入的字符串index - 位置public static Object createObjectFromParams(String params, String thingPath, ActionContext actionContext)
public static Object createObjectFromParams(Map<String,?> values, String thingPath, ActionContext actionContext)
public static boolean isNotNull(String str)
public static boolean isNull(String str)
public static void debug(ActionContext context, Object obj)
public static int[] toIntArray(String intArray)
public static Map<String,String> getParams(String str)
str - 参数字符串public static Map<String,String> getParams(String str, String splitStr)
str - 参数字符串splitStr - 分隔符public static Map<String,String> getParams(String str, String splitStr, String encoding)
str - 参数字符串splitStr - 分隔符encoding - 编码public static Map<String,String> getParams(String str, String splitStr, String encoding, boolean trimQuotate)
str - 参数字符串splitStr - 分隔符encoding - 编码trimQuotate - 是否过滤参数值包围的引号public static int getInt(String str)
public static String getString(Thing thing, String attribute, ActionContext actionContext)
thing - 事物attribute - 属性名actionContext - 变量上下文public static String getString(String value, ActionContext actionContext)
从制定的字符串值中读取字符串。
如果字符串值为"号开头,那么返回"号包围的字符串值,如果是以res:开头那么从资源文件中读取,如果以上条件都不符合那么从 actionContext或binding中读取。
如果是读取资源,那么字符串的格式为:res:<resourceName>:<varName>:<defaultValue>。value - 字符串值actionContext - 动作上下文public static char toHex(int nibble)
public static String trimFileName(String str)
str - public static String toHexString(byte[] bytes)
public static byte[] hexStringToByteArray(String hex)
hex - 16进制字符串public static String getSizeInfo(double size)
Copyright © 2018 xworker.org. All rights reserved.