J2EE-UP
j2ee struts spring hibernate
BlogJava
::
首頁
::
新隨筆
::
聯系
::
聚合
::
管理
posts - 24, comments - 25, trackbacks - 0
<
2011年4月
>
日
一
二
三
四
五
六
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
常用鏈接
我的隨筆
我的文章
我的評論
我的參與
最新評論
留言簿
(2)
給我留言
查看公開留言
查看私人留言
隨筆分類
html+css(1)
Java(7)
javascript(1)
POI-Excel/Word(3)
Struts2.x(8)
web(4)
隨筆檔案
2011年8月 (1)
2011年7月 (1)
2011年4月 (4)
2010年6月 (1)
2009年4月 (1)
2009年3月 (1)
2009年2月 (1)
2008年12月 (4)
2008年11月 (2)
2008年2月 (5)
2008年1月 (3)
文章檔案
2010年11月 (1)
搜索
最新評論
1.?re: Struts2自定義標簽
大概看懂了,跟那個s標簽一樣用法,只是這里是自己在定義一個標簽來用就是了。
--問問
2.?re: web中使用POI的例子[未登錄]
3333
--a
3.?re: 輸出流下載文件[未登錄]
asdf
--aaa
4.?re: struts2.0的標簽庫(簡介)
樓主,愛死你了。總結的好啊。
--windkiller
5.?re: Struts2自定義標簽[未登錄]
寫得什么啊!亂七八糟的。
--doudou
閱讀排行榜
1.?struts2.0的標簽庫(簡介)(18057)
2.?struts2日期標簽小結(8543)
3.?Struts2自定義標簽(7124)
4.?web中使用POI的例子(4582)
5.?POI簡單應用(word,excel)(3458)
評論排行榜
1.?struts2.0的標簽庫(簡介)(10)
2.?POI簡單應用(word,excel)(5)
3.?Struts2自定義標簽(3)
4.?web中使用POI的例子(2)
5.?struts2日期標簽小結(2)
一些數據操作
/** */
/**
* 字符型后面加空格
*
*
@param
str
*
@param
leng
*
@return
*/
public
static
String changString(String str,
float
leng)
{
if
(StringUtil.isBlank(str))
{
str
=
"
"
;
}
int
count
=
new
Double(leng).intValue();
for
(
int
i
=
str.length(); i
<
count; i
++
)
{
str
=
str
+
"
"
;
}
if
(str.length()
>
count)
{
str
=
str.substring(
0
, count);
}
return
str;
}
/** */
/**
* 數字型前面加零
*
*
@param
str
*
@param
leng
*
@return
*/
public
static
String changNumber(String str,
float
leng)
{
if
(StringUtil.isBlank(str))
{
str
=
"
0
"
;
}
int
count
=
new
Double(leng).intValue();
for
(
int
i
=
str.length(); i
<
count; i
++
)
{
str
=
"
0
"
+
str;
}
if
(str.length()
>
count)
{
str
=
str.substring(str.length()
-
count, str.length());
}
return
str;
}
/** */
/**
* 數字型前面加零
*
*
@param
num
*
@param
leng
*
@return
*/
public
static
String changInt(
int
num,
float
leng)
{
String str
=
num
+
""
;
return
changNumber(str, leng);
}
/** */
/**
* 寫文件
*
*
@param
path
*
@param
content
*
@return
*/
public
static
boolean
write(String path, String content)
{
try
{
File file
=
new
File(path);
//
存在刪除
if
(file.exists())
{
file.delete();
}
//
不存在新建
if
(
!
file.createNewFile())
{
return
false
;
}
BufferedWriter output
=
new
BufferedWriter(
new
FileWriter(file));
output.write(content);
output.close();
}
catch
(Exception e)
{
return
false
;
}
return
true
;
}
/** */
/**
* 刪除文件
*
*
@param
path
*/
public
static
void
delete(String
path)
{
for
(
int
i
=
0
; i
<
path.length; i
++
)
{
File file
=
new
File(path[i]);
if
(file.exists())
{
file.delete();
}
}
}
/** */
/**
* 昨天同一時間
*
@param
today
*
@return
*/
public
static
Date yesterday(Date today)
{
Calendar cal
=
Calendar.getInstance();
cal.setTime(today);
cal.add(Calendar.DATE,
-
1
);
return
cal.getTime();
}
posted on 2011-04-19 11:04
Jarry
閱讀(218)
評論(0)
編輯
收藏
所屬分類:
Java
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
Map排序
字符的截取
簡單的線程控制
一些數據操作
FTP上傳、下載、刪除
SMTP郵件發送
Java抽取Word,PDF格式文件
Powered by:
BlogJava
Copyright ©2025 Jarry
主站蜘蛛池模板:
类乌齐县
|
台中县
|
永福县
|
新平
|
宜兰市
|
西乌
|
滕州市
|
闻喜县
|
灵宝市
|
红桥区
|
张家港市
|
剑川县
|
本溪
|
东丽区
|
彩票
|
唐海县
|
平泉县
|
香港
|
盐池县
|
旬邑县
|
水富县
|
蒲江县
|
太仓市
|
宁蒗
|
梁平县
|
彰武县
|
马龙县
|
兴宁市
|
九台市
|
易门县
|
石家庄市
|
临西县
|
剑阁县
|
江城
|
天门市
|
邢台县
|
黄浦区
|
鹤壁市
|
湘乡市
|
江永县
|
曲松县
|