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 socket编程(也是学习多线程的例子)详细版----转
7.2 面向套接字编程 我们已经通过了解Socket的接口,知其所以然,下面我们就将通过具体的案例,来熟悉Socket的具体工作方式 7.2.1使用套接字实现基于TCP协议的服务器和客户机程序 ...
- JS的__proto__与prototype
一.prototype和__proto__的概念 prototype是函数的一个属性(每个函数都有一个prototype属性),这个属性是一个指针,指向一个对象.它是显示修改对象的原型的属性. __p ...
- ASP.NET下使用Combres对JS、CSS合并和压缩
记录一下,如何简单快捷压缩js和css,通过合并来减少请求次数. 用到的网址: http://www.nuget.org/packages/combres/ https://github.com/bu ...
- SinGooCMS 内容管理系统
功能简介: -------------------------------------------------------------------- 案例 德业基 路升光电 博阅科技 明仁律师 卓兔网 ...
- WPF窗口启动时最大化
在xaml对应的后台代码文件的初始化方法中: public ShellView() { InitializeComponent(); #region 启动时串口最大化显示 Rect rc = Syst ...
- C#中的NameValueCollection简介
NameValueCollection继承自NameObjectCollectionBase,并且和一般的键值对不同的是,它支持集合中出现相同的Key. 引用:using System.Collect ...
- 数据分析融入至BI工具的新思路
欢迎访问网易云社区,了解更多网易技术产品运营经验. 很认同一种说法:BI对企业的作用不是BI本身,而是数据本身.那么BI的作用和意义是干什么的呢-是让有意义的数据自己说出自己意义的工具. BI发展至今 ...
- map函数和reduce函数、filter函数的区别
①从参数方面来讲:map()函数: map()包含两个参数,第一个是参数是一个函数,第二个是序列(列表或元组).其中,函数(即map的第一个参数位置的函数)可以接收一个或多个参数.reduce()函数 ...
- Android与js交互
本文转载自:http://blog.csdn.net/it1039871366/article/details/46372207 一文. Android 中可以通过webview来实现和js的交互,在 ...
- 974. Subarray Sums Divisible by K
Given an array A of integers, return the number of (contiguous, non-empty) subarrays that have a sum ...