设为首页 加入收藏

TOP

开发中日常操作转化工具类(七)
2014-11-24 12:02:24 】 浏览:1918
Tags:开发 日常 操作 转化 工具
s() && !ipAddress.isLoopbackAddress()
&& ipAddress.getHostAddress().indexOf(":") == -1)
{
siteString = ipAddress.getHostAddress();
}
}
}
catch (Exception e)
{
e.toString();
}
return siteString;
}
/**
* 〈trim公共方法
* 〈功能详细描述
* @param str str
* @return String
*/
public static String trim(String str)
{
if (str != null)
{
str = str.trim();
}
return str;
}
/**
* 检查算法表达式合法性
* @param calculateScript 计算脚本
* @return 返回true表达式合 ,false表达式不合法
*/
public static boolean checkCalculateScript(String calculateScript)
{
return true;
}
/**
* 获取 系统时间
* @return 当前系统时间
*/
public static Date getSysDate()
{
SimpleDateFormat ft = null;
Calendar cal = Calendar.getInstance();
// 格式可以自己根据要求修改
ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateTime = ft.format(cal.getTime());
Date nowDate = null;
try
{
nowDate = ft.parse(dateTime);
}
catch (ParseException e)
{
LOG.error(e);
// e.printStackTrace();
}
return nowDate;
}
/**
* 〈根据系统当前时间获取下一个月日期对象〉
* 〈功能详细描述〉
* @return Date
*/
public static Date getNextMonth()
{
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MONTH, 1);
return cal.getTime();
}
/**
* 设置文件输出流的文件名
* @param failName 文件名
* @param response void
*/
public static void responseSetHeader(String failName, HttpServletResponse response)
{
response.setHeader("Content-disposition", "attachment; filename=" + failName);
response.setContentType("application/msexcel");
}
/**
*〈为空验证〉
* @param str 待验证字符串
* @param prop prop
* @return boolean
*/
protected static boolean empty(String str, String prop)
{
if (str == null)
{
return false;
}
if ("".equals(str.trim()))
{
return false;
}
return true;
}
/*
*〈按字节验证字符串长度〉
* @param str 待验证字符串
* @param prop prop
* @return boolean
*/
/* public static boolean byteLength(String str, String prop)
{
int length = 20;
if (Util.isEmpty(str))
{
return true;
}
char[] chars = str.toCharArray();
int len = 0;
for (int i = 0; i < chars.length; i++)
{
len++;
//判断是否非字母
if (chars[i] / 0x80 == 0)
{
len++;
}
}
return len <= length;
}*/
/**
*〈非法字符〉
* @param str 待验证字符串
* @param prop prop
* @return boolean
*/
protected static boolean lawless(String str)
{
boolean result = false;
if (Util.is
首页 上一页 4 5 6 7 8 9 下一页 尾页 7/9/9
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇数学运算工具类 下一篇利用JDBC连接取数据并导入到EXCEL..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目