File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed
APIJSONORM/src/main/java/apijson Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change 77
88import java .util .List ;
99import java .util .Set ;
10+ import java .util .StringTokenizer ;
1011
1112import com .alibaba .fastjson .JSONArray ;
1213import com .alibaba .fastjson .JSONObject ;
@@ -502,23 +503,17 @@ public static String formatColon(@NotNull String key) {
502503 * @return
503504 */
504505 public static String formatHyphen (@ NotNull String key , boolean firstCase ) {
505- boolean first = true ;
506- int index ;
507-
508506 String name = "" ;
509- String part ;
510- do {
511- index = key .indexOf ("-" );
512- part = index < 0 ? key : key .substring (0 , index );
513-
514- name += firstCase && first == false ? StringUtil .firstCase (part , true ) : part ;
515- key = key .substring (index + 1 );
516507
517- first = false ;
518- }
519- while (index >= 0 );
508+ StringTokenizer parts = new StringTokenizer (key , "-" );
509+ name += parts .nextToken ();
510+ while (parts .hasMoreTokens ())
511+ {
512+ String part = parts .nextToken ();
513+ name += firstCase ? StringUtil .firstCase (part , true ) : part ;
514+ }
520515
521- return name ;
516+ return name ;
522517 }
523518
524519
You can’t perform that action at this time.
0 commit comments