zoukankan      html  css  js  c++  java
  • j2ee常用方法

    
    
    
    
    private List<String> strToListString(String s){
            List<String> list = new ArrayList<>();
            String[] split = s.split(",");
    
            for(int i=0;i<split.length;i++) {
                list.add(split[i]);
            }
            return list;
        }
     private static String listToString(List<String> list){
            StringBuilder sb=new StringBuilder();
            for (int i = 0; i < list.size(); i++) {
                if (i != list.size() - 1) {
                    sb.append(list.get(i) + ",");
                }else{
                    sb.append(list.get(i));
                }
            }
            return sb.toString();
        }
    
    
    

      

     

    spring-beans-xx.xx.jar

    package org.springframework.beans;
    BeanUtils
        public static void copyProperties(Object source, Object target, String... ignoreProperties) throws BeansException {
            copyProperties(source, target, (Class)null, ignoreProperties);
        }

    commons-collections-xx-xx.jar

    package org.apache.commons.collections;
    CollectionUtils
     public static boolean isEmpty(Collection coll) {
            return (coll == null || coll.isEmpty());
        }

    commons-lang-xx-xx.jar

    package org.apache.commons.lang;
    StringUtils
        public static boolean isNotEmpty(String str) {
            return !StringUtils.isEmpty(str);
        }
    public static boolean isEmpty(String str) {
            return str == null || str.length() == 0;
        }

     异常堆栈信息转字符窜

     public static String getErrorInfoFromException(Exception e) {
            try {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e.printStackTrace(pw);
                return "
    " + sw.toString() + "
    ";
            } catch (Exception e2) {
                return "bad getErrorInfoFromException";
            }
        }

     去空格后是否空字符

    private boolean isNotEmptyAfterTrim(String s){
            if (StringUtils.isNotEmpty(s)){
                if (s.trim().length()!=0){
                    return true;
                }
            }
            return false;
        }
    

    字符窜格式化

  • 相关阅读:
    jqGrid jqGrid 参数
    jqgrid问题总结
    quartz的配置表达式
    Struts2接收参数的几种方式
    Perl爬虫代码
    PHP官方的PECL扩展有问题
    Perl单URL爬虫
    Perl 多进程进度条
    Perl Tk摸索
    hdu 2058 数学题
  • 原文地址:https://www.cnblogs.com/zfzf1/p/6652399.html
Copyright © 2011-2022 走看看