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类的源码 ...
随机推荐
- [Ubuntu Version] 如何在terminal 查看当前 ubuntu的版本号
命令: locate locate /etc/*release/etc/lsb-release/etc/os-release 命令: catcat /etc/os-releaseNAME=" ...
- Python学习-35.Python中的List Comprehensions(列表解释|列表生成式)
在某些情况下,我们需要对列表进行某些操作,例如对列表中的每一个元素都乘以2,这样一般来说就是遍历每个元素在乘以2.那么写下来就得两行了.而且这会修改原来的列表,如果要求不能修改原来的列表,又得多一行了 ...
- CentOS搭建NFS服务
系统结构 ----------------------------------------------------------------------------------------------- ...
- Golang Tcp粘包处理(转)
在用golang开发人工客服系统的时候碰到了粘包问题,那么什么是粘包呢?例如我们和客户端约定数据交互格式是一个json格式的字符串: {"Id":1,"Name" ...
- linux系统编程之信号(一):中断与信号
一,什么是中断? 1.中断的基本概念 中断是指计算机在执行期间,系统内发生任何非寻常的或非预期的急需处理事件,使得CPU暂时中断当前正在执行的程序而转去执行相应的事件处理程序,待处理完毕后又返回原来被 ...
- Spring Boot 2 实践记录之 Redis 及 Session Redis 配置
先说 Redis 的配置,在一些网上资料中,Spring Boot 的 Redis 除了添加依赖外,还要使用 XML 或 Java 配置文件做些配置,不过经过实践并不需要. 先在 pom 文件中添加 ...
- 【WPF】UserControl 的 Load事件
经过查看MSDN,总结下 UserControl 的 Load 事件: Q1:Load事件什么时候发生? 在控件第一次变为可见之前发生. Load事件发生在创建 UserControl 时,因此有些情 ...
- WebAPI的AuthorizeAttribute扩展类中获取POST提交的数据
在WEBAPI中,AuthorizeAttribute类重写时,如何获取post数据是个难题,网上找资料也不好使,只能自己研究,通过研究发现,WEBAPI给了我们获取POST数据的可能,下面介绍一下: ...
- H5实现页面内跳转页面
<!DOCTYPE html><html><body> <iframe src="/example/html/demo_iframe.html&qu ...
- dD Geometry Kernel ( Geometry Kernels) CGAL 4.13 -User Manual
1 Introduction This part of the reference manual covers the higher-dimensional kernel. The kernel co ...