/*
字符串比较
*public boolean equals(Object obj)
* public boolean equalsIgnoreCase(str)
*
* public int Length() 字符串长度
* public String concat(String str) 字符串拼接 返新串
* public char charAt(int index) 返回下标处字符
* public int indexOf(String str) 查找第一个字串
*
*字符串截取
* public String substring(int index) 截取从参数位置到末尾 返回新字符串
* public String substring(int begin,int end) [begin,end) 返新串
*
*字符串转换
* public char[] toCharArray() 将当前字符串拆分为字符数组作为返回值
* public byte[] getByte() 获得当前字符串底层的字节数组
* public String replace(CharSequence oldString,CharSequence newString)
* 将所有出现的老字符串替换为新字符串,返新串(CharSequence可以接受字符串类型)
*
*字符串分割
*public String[] split(String regex)按照参数的规则 将字符串切成若干部分
*参数regex为一个”正则表达式“ 若按照”.“进行切分 需要写”\\.“转义才可
* */
Java字符串常用处理方法
最新推荐文章于 2024-04-19 18:44:39 发布