请问JAVA有没有把字符串头字母转换成大些的东西? 懒得自己写了,问问有没有 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public static String capitalize(String str) { int strLen; if (str == null || (strLen = str.length()) == 0) { return str; } return new StringBuffer(strLen) .append(Character.toTitleCase(str.charAt(0))) .append(str.substring(1)) .toString(); }应该可以解决你的问题 capitalize("cat") = "Cat" capitalize("cAt") = "CAt" jdk 类库没有 2楼的应该不错。 java 读取文本文件并组装成对象 我是新手 请大家指教下这个程序 请问初学者要做CDLC1.1+MIDP2.0的项目,可以看哪些书? JAVA 求连数相加 用过itext制作pdf文件出错~ Software caused connection abort: recv failed 学Java怎么入手? ◇◇◇简单问题,立即送分◇◇◇ 请问c/s与b/s型式的有什么区别? websphere 中如何设置搜索bean的路径 请问点击按钮是停止暂停线程 java数组的问题(数组名称==null,这个条件判断的是什么?)
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return str;
}
return new StringBuffer(strLen)
.append(Character.toTitleCase(str.charAt(0)))
.append(str.substring(1))
.toString();
}应该可以解决你的问题 capitalize("cat") = "Cat"
capitalize("cAt") = "CAt"
jdk 类库没有 2楼的应该不错。