public class TestSubstring { public static void main(String[] args) {
public class TestSubstring { public static void main(String[] args) { String s = getConvert("adsJKJ3K21AfaAD134F13241d134134s141faAAFDF"); System.out.println(s); } //将一个字符串中的首字母转换成大写,其它的全部转换成小写 public static String getConvert(String str) { String first = str.substring(0, 1); String after = str.substring(1); //substring(1),获取索引位置1后面所有剩余的字符串 first = first.toUpperCase(); after = after.toLowerCase(); return "转换后的字符串:" + first + after; } }
赞
(420)
打赏
微信扫一扫
支付宝扫一扫


java字符串大写转小写,小写转大写
上一篇
2020年10月10日 13:11
Thymeleaf 排除标签(不写在标签中)直接显示内容
下一篇
2020年10月10日 13:23
这里是广告位
相关推荐
-
Sring Data JPA使用Predicate进行模糊查询、按时间段查询
10 : demoDTO.getSize();PageRequest pageRequest = new PageRequest;Specification<W
-
Thymeleaf——th:each遍历Map List
@RequestMappingpublic Object a3{Map<String,User> map1=new HashedMap();User user1
-
js与thymeleaf结合,js获取thymeleaf变量
<tr th:each=\"book : ${books}\"> <td th:text=\"${book.author}\"></td>