方便的方法

1.
String template="http://11111";
boolean flag=template.startsWith("http");

2.
String root="/home/8080/work/intl-menuserver/deploy/menu-resources/templates";
String template="new_gs/root.vm";
//file=/home/8080/work/intl-menuserver/deploy/menu-resources/templates/new_gs/root.vm
File file = new File(root, template);
//path=/home/8080/work/intl-menuserver/deploy/menu-resources/templates/new_gs
File  path = file.getParentFile();
//file=/home/8080/work/intl-menuserver/deploy/menu-resources/templates/default.vm
file = new File(path, "default.vm");

3.
String root="1 1 4";
root=StringUtils.trim(root);
//root="114"

4.
//java对象转换成xml格式
XStream xstream = new XStream();
String data = xstream.toXML(object);

你可能感兴趣的:(方法)