// Source File Name: StringUtil.java
package com.util;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
public class StringUtil
{
public StringUtil()
{
}
public static boolean isEmpty(String string)
{
return string == null || "".equals(string.trim());
}
public static boolean isNotEmpty(String string)
{
return !isEmpty(string);
}
public static String replaceForSql(String string)
{
return string.replaceAll("['\",;%*]", "").trim();
}
public static String urlEncode(String url, String encoding)
{
try
{
return URLEncoder.encode(url, encoding);
}
catch(UnsupportedEncodingException e)
{
e.printStackTrace();
}
return null;
}
public static String urlDecode(String url, String encoding)
{
try
{
return URLDecoder.decode(url, encoding);
}
catch(UnsupportedEncodingException e)
{
e.printStackTrace();
}
return null;
}
public static String first(String string)
{
return left(string, 1);
}
public static String left(String string, int count)
{
if(string.length() < count)
return string;
else
return string.substring(0, count);
}
public static String right(String string, int count)
{
return string.substring(string.length() - count);
}
public static String last(String string)
{
return right(string, 1);
}
public static String removeLast(String string, int count)
{
if(string.length() <= count)
return "";
else
return string.substring(0, string.length() - count);
}
public static String removeLast(String string)
{
return removeLast(string, 1);
}
public static String trim(String string, String remove)
{
if(string != null && string.length() > 0)
{
boolean b = string.indexOf(remove) == 0;
boolean e = string.lastIndexOf(remove) == string.length() - 1;
if(b && string.length() > 1)
string = string.substring(1);
if(e)
string = string.substring(0, string.length() - 1);
if(b || e)
string = trim(string, remove);
}
return string;
}
public static String byte2hex(byte b[])
{
String hex = "";
String stmp = "";
for(int i = 0; i < b.length; i++)
{
stmp = Integer.toHexString(b[i] & 0xff);
if(stmp.length() == 1)
hex = (new StringBuilder(String.valueOf(hex))).append("0").append(stmp).toString();
else
hex = (new StringBuilder(String.valueOf(hex))).append(stmp).toString();
}
return hex.toLowerCase();
}
public static byte[] hex2byte(String string)
{
byte b[] = string.getBytes();
byte bytes[] = new byte[b.length / 2];
for(int i = 0; i < b.length; i += 2)
{
String item = new String(b, i, 2);
bytes[i / 2] = (byte)Integer.parseInt(item, 16);
}
return bytes;
}
public static byte[] string2byte(String string)
{
try
{
return string.getBytes("utf-8");
}
catch(UnsupportedEncodingException e)
{
return null;
}
}
public static String byte2string(byte bytes[])
{
try
{
return new String(bytes, "utf-8");
}
catch(UnsupportedEncodingException e)
{
return null;
}
}
public static boolean contains(String string, String s, String split)
{
if(string == null || s == null)
{
return false;
} else
{
string = (new StringBuilder(String.valueOf(split))).append(trim(string, split)).append(split).toString();
s = (new StringBuilder(String.valueOf(split))).append(trim(s, split)).append(split).toString();
return string.contains(s);
}
}
public static boolean contains(String string, String s)
{
return contains(string, s, ",");
}
public static String toUnicode(String string)
{
StringBuilder sb = new StringBuilder();
char cs[] = string.toCharArray();
char ac[];
int j = (ac = cs).length;
for(int i = 0; i < j; i++)
{
char c = ac[i];
String tmp = Integer.toHexString(c);
sb.append(tmp.length() != 4 ? ((Object) (Character.valueOf(c))) : ((Object) ((new StringBuilder("\\u")).append(tmp).toString())));
}
return sb.toString();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Axis2集成SSH搭建WebService源代码
共42个文件
class:8个
mar:7个
java:6个
5星 · 超过95%的资源 需积分: 11 64 下载量 132 浏览量
2014-08-23
00:43:54
上传
评论
收藏 175KB ZIP 举报
温馨提示
Axis2集成SSH搭建WebService项目的源代码,这个里面不包含各种依赖jar包,需要的朋友在我的CSDN里面找自行下载吧!另外,我写了一篇文章,详细介绍了如何搭建的,图文源码都有,还有测试用例。希望对大家有所帮助。
资源推荐
资源详情
资源评论
收起资源包目录
Axis2SSHWebService.zip (42个子文件)
Axis2SSHWebService
.project 2KB
.mymetadata 327B
src
applicationContext.xml 5KB
com
service
LifeHelpService.java 522B
impl
ConvenientTravelServiceImpl.java 1KB
LifeHelpServiceImpl.java 1KB
ConvenientTravelService.java 611B
action
model
dao
impl
util
FlipPageInfo.java 3KB
StringUtil.java 5KB
log4j.properties 569B
WebRoot
WEB-INF
conf
axis2.xml 26KB
services
version-1.6.2.aar 8KB
services.list 18B
MyService
META-INF
services.xml 2KB
modules
soapmonitor-1.6.2.mar 11KB
addressing-1.6.2.mar 30KB
axis2-jaxws-mar-1.6.2.mar 9KB
mtompolicy-1.6.2.mar 14KB
mex-1.6.2.mar 33KB
scripting-1.6.2.mar 29KB
ping-1.6.2.mar 13KB
modules.list 139B
classes
applicationContext.xml 5KB
com
service
impl
LifeHelpServiceImpl.class 2KB
ConvenientTravelServiceImpl.class 2KB
LifeHelpService.class 231B
ConvenientTravelService.class 351B
action
model
dao
impl
DAOImpl.class 16KB
DAO.class 7KB
util
StringUtil.class 4KB
FlipPageInfo.class 3KB
log4j.properties 569B
lib
web.xml 3KB
index.jsp 834B
META-INF
MANIFEST.MF 36B
.myeclipse
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.jdt.core.prefs 395B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.component 492B
.jsdtscope 500B
.classpath 529B
共 42 条
- 1
资源评论
- qq_153453752014-12-25试过了,还是可以运行的
- 我S新手2015-05-29不错,比较详细,适合新手
- pbpengfei2014-09-03不错,比较详细,适合新手。
- liushun2752057132015-05-02还可以,新手可以去试试
陈梦洲
- 粉丝: 3
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功