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编程中Properties类的具体作用和使用!
如果不熟悉 java.util.Properties类,那么现在告诉您它是用来在一个文件中存储键-值对的,其中键和值是用等号分隔的.(如清单 1 所示).最近更新的java.util.Properti ...
- [LeetCode 题解] Search in Rotated Sorted Array
前言 [LeetCode 题解]系列传送门: http://www.cnblogs.com/double-win/category/573499.html 题目描述 Suppose an array ...
- 使用sos查看.NET对象内存布局
前面我们图解了.NET里各种对象的内存布局,我们再来从调试器和clr源码的角度来看一下对象的内存布局.我写了一个测试程序来加深对.net对象内存布局的了解: using System; using S ...
- ASP .Net Core路由(Route) - 纸壳CMS的关键
关于纸壳CMS 纸壳CMS是一个开源免费的,可视化设计,在线编辑的内容管理系统.基于ASP .Net Core开发,插件式设计: GitHub:https://github.com/SeriaWei/ ...
- asp.net 下载EXCEL文件
一.需要导入NPOI 库文件 打开VS2012 工具>>库程序包管理器>>管理解决方案的NuGet程序包,搜索NPOI,如下图 安装完成: 添加 using NPOI.HSSF ...
- 关于Select选中问题
jquery根据text选中option的问题: 网上找了好多,但发现因为jquery版本问题,很多并不能用. 最后成功了,写法如下: $('#shop option:contains(' + ...
- Day 29 _模块二 -hashlib_configparse_logging
一.hashlib Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. 什么是摘要算法呢?摘要算法又称哈希算法.散列算法.它通过一个函数,把任意长度的数据转换为一个长度固定的数 ...
- 没有过的题QAQ
持续更新...纪念一下我的高分暴力...(好丢人啊qwq) NOI2014 动物园 80pts 用倍增暴力跳nxt数组 #include<iostream> #include<cst ...
- sublime 把 tab 转成 4 个空格
Preferences -> Settings-User { "tab_size":4, "translate_tabs_to_spaces" ...
- 八,mysql优化——读写分离
读写分离目的是给大型网站缓解查询压力.