类 Utils
java.lang.Object
com.gdxsoft.easyweb.utils.Utils
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static String将数组拼接为字符串static Stringbyte2hex(byte[] b) 已过时。static Stringbytes2hex(byte[] b) 将byte数组转换为16进制字符串static String已过时。static booleanConverts a Object to a boolean
Utils.cvtBool(null) = false
Utils.cvtBool("true") = true
Utils.cvtBool("TRUE") = true
Utils.cvtBool("tRUe") = true
Utils.cvtBool("on") = true
Utils.cvtBool("yes") = true
Utils.cvtBool("是") = true
Utils.toBoolean("y") = true
Utils.toBoolean("t") = truestatic int将字符串转换为整数,并忽略错误static IntegercvtInteger(String v) 将字符串转换为整型,并忽略错误static String删除字符串中的内容static String生成编码的URLstatic StringfilterHtml(String str) 基本功能:过滤所有以"<"开头以">"结尾的标签static StringgetAlertScript(String s1) static Date根据字符串返回日期static Date根据字符返回日期static String获取GMT(0)时间表达式,用于 Last-Modified等static StringgetDateGMTString(Calendar calendar) 获取GMT(0)时间表达式,用于 Last-Modified等static StringgetDateGMTString(Date date) 获取GMT(0)时间表达式,用于 Last-Modified等static StringgetDateString(Timestamp t1, String dateformatString) 获取时间格式static StringgetDateString(Calendar calendar, String dateformatString) 获取指定格式的 日期字符串
格式例如 yyyy-MM-dd HH:mm:ssstatic StringgetDateString(Date date) 获取默认格式 日期 ,例如2011-04-02static StringgetDateString(Date date, String dateformatString) 获取指定格式的 日期字符串
格式例如 yyyy-MM-dd HH:mm:ssstatic StringgetDateTimeString(Date date) 获取默认格式 日期和时间 ,例如 2011-04-02 11:29:31static String返回时间的xml格式,yyyy-mm-ddTHH:MM:SSstatic int获取和当天的日期天数static int返回两个日期之间的天数static int计算显示的宽度static String转换为gbkstatic StringgetGuid()获取 UUIDstatic StringgetJavascript(String s1) static StringgetOptions(String valueList, String textList, String v1) 获取SELECT的OPTION列表static MListStrgetParameters(String sql, String tag) 获取字符串中的参数(含中文)
例如:{CALL PR_EWA_HOR_STR (@a, @CO_UNID, @姓名, @姓名.hash)}getParameters(String s1, String tagStart, String tagEnd) 获取被前后标记包围的内容,例如{12121}static String[]getSqlSplit(String sql, String tag) 分割字符串为数组static ObjectgetTimeDiffValue(Object oriValue, int timeDiffMinutes) 获取时间与时差计算后的结果static TimestampgetTimestamp(String s1, String lang, boolean isUKFormat) 获取sql的timestampstatic StringgetTimeString(Date date) 获取默认格式 时间 ,例如 11:29:31static String转换为utf8static byte[]转换 hex字符串为二进制static Stringmd5(byte[] bytes) 取bytes的md5摘要static String取str的md5摘要static StringrandomStr(int length) 利用随机数生成字符串static String基本功能:替换指定的标签static voidreplaceStringBuilder(StringBuilder source, String findString, String replaceString) 替换 StringBuilder 的字符串static Stringsha1(byte[] bytes) 取bytes的 sha1 摘要static String取str的 sha1 摘要static String[][]split2String(String s1, String splitString0, String splitString1) 分割双重数组static String[]splitString(String s1, String splitString) 分割字符串,内容中若保留分割符,则表示两次,如“,”分割的话,内容中保留则通过",,"表示static booleantestString(String sourceString, String regexString) 正则测试static StringtextToHtml(String text) 将纯文本转换为HTMLstatic StringtextToInputValue(String text) 将纯文本转换成input/textarea所需格式static StringtextToJscript(String text) 生成脚本可以使用的文字,替换回车,双引号和 ”\“符static StringURLEncoder.encode (UTF-8)编码static longtimeDiffDays(Date t1, Date t2) t1-t2的间隔天数static longtimeDiffHours(Date t1, Date t2) t1-t2的间隔小时数static longtimeDiffMinutes(Date t1, Date t2) t1-t2的间隔分钟数static longtimeDiffMSeconds(Date t1, Date t2) t1-t2的间隔毫秒static longtimeDiffSeconds(Date t1, Date t2) t1-t2的间隔秒数static StringtoJsonPair(String name, String value) 生成Json成对表达式static StringURLDecoder.decode (UTF-8) 解码
-
构造器详细资料
-
Utils
public Utils()
-
-
方法详细资料
-
getJavascript
-
getAlertScript
-
randomStr
-
toJsonPair
-
timeDiffHours
-
timeDiffDays
-
timeDiffMinutes
-
timeDiffSeconds
-
timeDiffMSeconds
-
split2String
-
splitString
-
cvtBool
Converts a Object to a boolean
Utils.cvtBool(null) = false
Utils.cvtBool("true") = true
Utils.cvtBool("TRUE") = true
Utils.cvtBool("tRUe") = true
Utils.cvtBool("on") = true
Utils.cvtBool("yes") = true
Utils.cvtBool("是") = true
Utils.toBoolean("y") = true
Utils.toBoolean("t") = true- 参数:
object- the Object to check- 返回:
- boolean result
-
cvtInteger
-
cvtInt
-
arrayJoin
-
createEncryptString
已过时。同 sha1, sha1 摘要- 参数:
s1- 原始字符- 返回:
- sha1 摘要(HEX)
-
sha1
-
sha1
-
md5
-
md5
-
bytes2hex
-
byte2hex
已过时。拼写错误,请用 bytes2hex 将byte数组转换为16进制字符串- 参数:
b- byte数组- 返回:
- 16进制字符串
-
hex2bytes
-
getUtf8
-
getGbk
-
getParameters
-
getParameters
-
testString
-
getSqlSplit
-
textToInputValue
-
textToHtml
-
textToJscript
-
textToUrl
-
urlToText
-
encodeUrl
-
getTimeDiffValue
-
getDateString
-
getDateGMTString
-
getDateGMTString
-
getDateGMTString
-
getDateXmlString
-
getDateString
-
getDateString
-
getDateString
-
getDateTimeString
-
getTimeString
-
getGuid
-
getOptions
-
getDays
-
getDays
-
getDate
-
getDate
-
getTimestamp
-
getDisplayWidth
-
replaceStringBuilder
public static void replaceStringBuilder(StringBuilder source, String findString, String replaceString) 替换 StringBuilder 的字符串- 参数:
source- StringBuilder源findString- 需要替换的文字replaceString- 替换的内容
-
deleteStr
-
filterHtml
-
replaceHtmlTag
-