MCPcopy Index your code
hub / github.com/Bit0r/java-util / main

Method main

src/main/java/util/SqlHump.java:11–38  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

9
10public class SqlHump {
11 public static void main(String[] args) {
12 String str = "a.id,\n" +
13 "a.id as order_material_id,\n" +
14 "k.payment_date as balance_payment_date";
15 String[] strings = str.split(",");
16 List<String> stringList = new ArrayList<>();
17 for (String data : strings){
18
19 if(data.indexOf("a.material_id") >=0){
20// System.out.println(data);
21 }
22 if(data.indexOf(" as ")>=0){
23 String[] strings1 = data.split("as");
24 String j = underlineToHump(strings1[1]);
25 data = strings1[0] +" as " + j;
26
27 }else {
28 String j = data.substring(data.indexOf(".")+1);
29 j = underlineToHump(j);
30 data = data +" as " + j;
31
32 }
33 stringList.add(data);
34 }
35
36 String sql =stringList.stream().collect(Collectors.joining(","));
37 System.out.println(sql);
38 }
39
40
41

Callers

nothing calls this directly

Calls 1

underlineToHumpMethod · 0.95

Tested by

no test coverage detected