java.lang 类String
返回指定索引处的 char 值。
index - char 值的索引。
2 string
concat(String str)
将指定字符串连接到此字符串的结尾。
str - 连接到此 String 结尾的 String。
substring(int beginIndex)
返回一个新的字符串,它是此字符串的一个子字符串。
beginIndex - 起始索引(包括)。
3 boolean
endsWith(String suffix)
测试此字符串是否以指定的后缀结束。
suffix - 后缀。
startsWith(String prefix)
测试此字符串是否以指定的前缀开始。
equals(Object anObject)
将此字符串与指定的对象比较。
anObject - 与此 String 进行比较的对象
equalsIgnoreCase(String anotherString)
将此 String 与另一个 String 比较,不考虑大小写。
anotherString - 与此 String 进行比较的 String。
4 int
indexOf(int ch)
返回指定字符在此字符串中第一次出现处的索引。
ch - 一个字符
indexOf(int ch, int fromIndex)
返回在此字符串中第一次出现指定字符处的索引,从指定的索引开始搜索。
ch - 一个字符 fromIndex - 开始搜索的索引。
indexOf(String str)
返回指定子字符串在此字符串中第一次出现处的索引。
str-任意字符串
indexOf(String str, int fromIndex)
返回指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始。
str - 要搜索的子字符串。fromIndex - 开始搜索的索引位置。
public int lastIndexOf(int ch)
public int lastIndexOf(iint ch, int fromIndex)
public int lastIndexOf(String str)
public int lastIndexOf(String str, int fromIndex)
length()
返回此字符串的长度。
未完待续。。。。。
java.lang 类String的更多相关文章
- tk.mybatis 报错:tk.mybatis.mapper.MapperException: tk.mybatis.mapper.MapperException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'apiLogMapper ...
- 从字节码和JVM的角度解析Java核心类String的不可变特性
1. 前言 最近看到几个有趣的关于Java核心类String的问题. String类是如何实现其不可变的特性的,设计成不可变的好处在哪里. 为什么不推荐使用+号的方式去形成新的字符串,推荐使用Stri ...
- java.lang.StringIndexOutOfBoundsException: String index out of range: 0
hibernet 报错 java.lang.StringIndexOutOfBoundsException: String index out of range: 0 处理方法 数据表字段为char ...
- Spring Boot 启动报错 Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37
使用命令 java -jar springBoot.jar 启动项目,结果报错如下: Exception at java.lang.String.substring(String.java:) at ...
- java能不能自己写一个类叫java.lang.System/String正确答案
原文: http://www.wfuyu.com/php/22254.html 未做测试 ! 最近学习了下java类加载相干的知识.然后看到网上有1道面试题是 能不能自己写个类叫java.lang.S ...
- java常用类String
String: String类: 代表字符串 是一个final类,代表不可变的字符序列 字符串是常量,用双引号引起来表示.值在创建后不可更改 String对象的字符内容是存储在一个字符数组Value[ ...
- Java 常用类String类、StringBuffer类
常用类 String类.StringBuffer类 String代表不可变的字符序列 "xxxxxxx"为该类的对象 举例(1) public class Test { publi ...
- Java使用类-String
String,StringBuffer,StringBuild 大佬的理解-><深入理解Java中的String> 1.String 1.1 String 实例化 String st ...
- 深入理解Java常用类----String
Java中字符串的操作可谓是最常见的操作了,String这个类它封装了有关字符串操作的大部分方法,从构建一个字符串对象到对字符串的各种操作都封装在该类中,本篇我们通过阅读String类的源码 ...
随机推荐
- java Map集合学习
学习语法还是从例子着手: FileDao fileDao=new FileBeanDaoImpl(); FileBean fileBean=new FileBean(); listBean=fileD ...
- Python学习-36.Python中的字典解释
具体同列表解释,也是使用if来进行过滤 例子,生成一个新的字典,并且是原来字典的键值交换. mydict={'Tom':18,'Mary':20} print({value:key for key,v ...
- zabbix-server启动报错解决
启动zabbix-server有如下报错: 29171:20180714:084911.367 cannot start alert manager service: Cannot bind sock ...
- mod_pagespeed
https://github.com/pagespeed/mod_pagespeed.git https://developers.google.com/speed/pagespeed/module/ ...
- 命名空间“Microsoft”中不存在类型或命名空间名“Reporting”(是否缺少程序集引用?)
IDE升级到VS2017之后,出现了如题所示的报错,重新引用DLL的方法如下: 1.右键引用,选择添加引用. 2.左侧选择浏览,下面点击浏览按钮. 3.分别添加Microsoft.ReportView ...
- Keil下Debug随笔
很多时候我们需要通过硬件仿真来调试程序,在仿真时有时候会遇到这样的情况,那就是选择全速运行时,我们的全局变量无法随时更新,而在那设一个断点后发现值是变化的,那么为什么会出现这种情况呢,那就是可能是我们 ...
- 《JavaScript高级程序设计》5.5 Function类型
5.5 Function类型 函数实质上是对象, 每个函数都是Function类型的实例, 并且都和其他引用类型一样具有属性和方法. 因此函数名实际上也是一个指向函数对象的指针, 不会与某个函数绑定. ...
- 认识与学习shell
linux的终端机执行命令的方式,是通过bash环境来处理的.bash包括变量的设置与使用,.bash操作环境的构建.数据流重定向的功能.下面的知识,对主机的维护与管理有重要的帮助. 管理整个计算机硬 ...
- Android Studio - No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
错误提示: No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android 错 ...
- django 使用celery 实现异步任务
celery 情景:用户发起request,并等待response返回.在本些views中,可能需要执行一段耗时的程序,那么用户就会等待很长时间,造成不好的用户体验,比如发送邮件.手机验证码等. 使用 ...