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类的源码 ...
随机推荐
- Ansible基本命令
Ansible安装完成之后就自带很多命令,其中较常用的有7个: ansible ansible-doc ansible-galaxy ansible-init ansible-playbook ans ...
- What if you are involved in an automobile accident in the US
What if you are involved in an automobile accident in the US With increasing Chinese tourists and vi ...
- 程序猿CET4和CET6考试攻略
写在前面: 学习一种语言是一个长期的过程,而且需要合适的语言环境,不是一朝一夕可以熟练掌握的,但是如果单纯地只是为了通过考试的话,就另当别论了 声明:本篇攻略纯属经验之谈,绝非任何性质的广告,仅供参考 ...
- .net core 基于Jwt实现Token令牌
Startup类ConfigureServices中 services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJw ...
- 【Cocos2d-Js基础教学(1)JS -Mac配置篇】
一.准备工作 Windows配置篇请见 http://cn.cocos2d-x.org/tutorial/show?id=1396 1.安装python 2.下载Android SDK Android ...
- Python 将一个时间戳格式化为(格林威治时间或者本地时区时间)
时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数. 获取一个时间戳 import time times = time. ...
- sql语句_2
数据表如下 一个user_id对应多个user_name,现在要求是:如果某个用户对应的user_name中存在一个a,打印user_id,a出来:如果不存在,打印user_id,0.打印时候user ...
- (4)Oracle基础--操作表中数据
· 添加数据 <1> INSERT 语句 ① 向表中所有字段添加值 语法: INSERT INTO table_name (column1,column2...) VALUES(val ...
- java 中 enum 枚举的使用
package test3; public final class Program { public static void main(String[] args) { // Sys ...
- 四:MyBatis学习总结(四)——解决字段名与实体类属性名不相同的冲突
在平时的开发中,我们表中的字段名和表对应实体类的属性名称不一定都是完全相同的,下面来演示一下这种情况下的如何解决字段名与实体类属性名不相同的冲突. 一.准备演示需要使用的表和数据 CREATE TAB ...