把下划线式变量转换成驼峰式变量

package com.ways.app.dpca.utils;

public class TestTransform {
	public static void main(String[] args) {
		String s = "manf,"+
       "brand,"+
       "car_series,"+
       "old_version_code,"+
       "model_name,"+
       "msrp,"+
       "segment,"+
       "launch_date,"+
       "emissions,"+
       "transmission,"+
       "year,"+
       "mon,"+
       "mix,"+
       "wholesale,"+
       "avg_tp,"+
       "q1,"+
       "q2,"+
       "q3,"+
       "q4,"+
       "nyear,"+
       "nyear_mix,"+
       "myear,"+
       "myear_mix,"+
       "cumulative_mix,"+
       "definition_price_tier";
		String strArr[] = s.split(",");
		String tempStr = "";
		for(String str:strArr){
			tempStr+=str;
			tempStr+=" as ";
			tempStr+=transform(str)+",";
			tempStr+="\n";
		}
		System.out.println(tempStr);
	}
	
	public static String transform(String str){
		while(str.contains("_")){
			int i = str.indexOf("_");
			if(i+1

 

你可能感兴趣的:(JAVA)