ITPub博客

首页 > 应用开发 > Java > java字符串常用方法

java字符串常用方法

原创 Java 作者:20170405 时间:2020-08-04 14:03:18 0 删除 编辑

  常用方法:

  boolean equals(String str);

  boolean equalsIgnoreCase(String str);

  int length();

  String concat(String str);//拼接字符串

  char charAt(int index);//获取索引位置字符

  int indexOf(String str);//查找参数字符串在本字符串中首次出现的索引位置,如果没有返回-1

  String substring(int begin);//截取字符串,从参数位置到字符串结尾

  String substring(int begin,int end);//截取字符串,左闭右开    郑州祛胎记医院哪家好 http://m.zykdtj.com/

  char[] toCharArray();//将当前字符串拆分为字符数组作为返回值

  byte[] getBytes();//获得当前字符串底层的字节数组

  String replace(charSequence oldString,charSequence newString);//将所有出现的老字符串替换为新字符串,返回替换后的

  String[] split(String regex);//按照参数规则,将字符串切分为若干部分


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69979119/viewspace-2709073/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: sql注入修改
请登录后发表评论 登录
全部评论

注册时间:2020-07-14

  • 博文量
    63
  • 访问量
    39790