zoukankan      html  css  js  c++  java
  • 下滑线转换为驼峰

    下划线转驼峰

     1 public static Object underline2Camel(String line,boolean smallCamel){
     2         if(line==null||"".equals(line)){
     3             return "";
     4         }
     5         StringBuffer sb=new StringBuffer();
     6         Pattern pattern=Pattern.compile("([A-Za-z\d]+)(_)?");
     7         Matcher matcher=pattern.matcher(line);
     8         while(matcher.find()){
     9             String word=matcher.group();
    10             sb.append(smallCamel&&matcher.start()==0?Character.toLowerCase(word.charAt(0)):Character.toUpperCase(word.charAt(0)));
    11             int index=word.lastIndexOf('_');
    12             if(index>0){
    13                 sb.append(word.substring(1, index).toLowerCase());
    14             }else{
    15                 sb.append(word.substring(1).toLowerCase());
    16             }
    17         }
    18         return sb.toString();
    19     }
  • 相关阅读:
    手势识别 ios
    无题
    核心动画笔记
    Quartz2D的学习2
    Quartz2D的学习1
    NSURLsessionTask
    NSURLSession
    POST请求的两种方式
    网络第一天
    NSThread
  • 原文地址:https://www.cnblogs.com/LifeFruit/p/13839088.html
Copyright © 2011-2022 走看看