public class Da { public static void main(String[] args) { String s = "hello_*java_*world"; System.out.println("转化前:"+s); String[] strs = s.split("_\\*"); String ret = ""; for(int i = 0; i < strs.length; i++){ if (i == (strs.length-1)){ ret = ret + strs[i].substring(0, 1).toUpperCase() + strs[i].substring(1, strs[i].length()); }else{ ret = ret + strs[i].substring(0, 1).toUpperCase() + strs[i].substring(1, strs[i].length())+ "_*"; } } System.out.println("转化后:"+ret); }}
原文地址:https://www.cnblogs.com/THEONLYLOVE/p/9117139.html
时间: 2024-10-11 22:59:16