JAVA 常用的是字符串处理函数2

字母的大小写转换

str.toLowerCae();-------------->hello world
str.toUpperCase();------------->HELLO WORLD


字符串的分割(字符串转数组)
split 方法的结果是一个字符串数组,
str.split(String a;int n)//a:从a处分割        n:分割的份数
Arrays.toString(str.split("o"))------------->[Hell,  W, rld]
Arrays.toString(str.split("o",2))----------->[Hell,  World]

 


判断字符串的开始和结束
str.startsWith("H")---------------->true    判断str是否是以字符串"H"开头
str.endWith("d")------------------->true    判断str是否是以字符串"d"结尾
原文链接:https://blog.csdn.net/m0_46319611/article/details/121308602

posted @   一只忙碌的蜗牛  阅读(18)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示