常用字符串API
java.lang.string.1.0
1.char charAt(int index)
返回给定位置的代码单元。
2.int codePointAt(int index)
返回从给定位置开始或字结束的代码点。
3.int offsetByCodePoints(int startIndex, int cpCount)
返回从startIndex代码点开始,位移cpCount后的代码点索引。
4.int compareTo(String other)
按照字典顺序,如果字符串位于other之前,返回一个负数;如果字符串位于other之后,返回一个正数;如果两个字符串相等,返回0。
5.boolean endsWith(String suffix)
如果字符串以suffix结尾,返回true。
6.boolean equals(Object other)
如果字符串与other相等,返回true。
7.boolean equalsIgnoreCase(String other)
如果字符串与other相等(忽略大小写),返回true。
8.int indexOf(String str)
int indexOf(String str, int fromIndex)
int indexOf(int cp)
int indexOf(int cp, int fromIndex)
返回与字符串str或者代码点cp匹配的第一个子串的开始位置。这个位置从索引0或fromIndex开始计算。如果原始串中不存在str,返回-1。
9.int lastIndexOf(String str)
int lastIndexOf(String str, int fromIndex)
int lastIndexOf(int cp)
int lastIndexOf(int cp, int fromIndex)
返回与字符串str或者代码点cp匹配的最后一个子串的开始位置。这个位置从原始串尾端或fromIndex开始计算。
10.int length()
返回字符串的长度。
11.int codePointCount(int startIndex, int endIndex)
返回startIndex和endIndex-1之间的代码点数量,没有配成对的代用字符将计入代码点。
12.String replace(CharSequence oldString, CharSequence newString)
返回一个新字符串。这个字符串用newString代替原始字符串中所有的oldString。可以用String或StringBuilder对象作为CharSequence参数。
13.boolean startWith(String prefix)
如果字符串以prefix字符串开始,返回true。
14.String substring(int beginIndex)
String substring(int beginIndex, int endIndex)
返回一个新字符串。这个字符串包含原始字符串中从beginIndex到串尾或者endIndex-1的所有代码单元。
15.String toLowerCase()
返回一个新字符串。这个字符串将原始字符串中的所有大写字母改成了小写字母。
16.String toUpperCase()
返回一个新字符串。这个字符串将原始字符串中的所有小写字母改成了大写字母。
17.String trim()
返回一个新字符串。这个字符串将删除了原始字符串头部和尾部的空格。
常用字符串API的更多相关文章
- React常用的API说明
楼主刚开始学习react,感受到了他的博大精深,看到很多莫名的用法,不知云云,找了很多没有找到参考手册,只有在中文社区和react官方看了一些,收集了一些比较常用的API,有补充的可以楼下评论补充.后 ...
- Appium常用的API函数
在学习应用一个框架之前,应该了解一下这个框架的整体结构或是相应的API函数.这篇文章还不错:http://blog.sina.com.cn/s/blog_68f262210102vzf9.html,就 ...
- 编程算法基地-2.1利用字符串API
2.1利用字符串API 字符串是Java类型最常用.并且是复合类型 串非常经常用于,其最佳API熟悉文档. 推断串中有没有反复的字符 String s ="abcdebxyz"; ...
- 生活常用类API调用的代码示例合集:邮编查询、今日热门新闻查询、区号查询等
以下示例代码适用于 www.apishop.net 网站下的API,使用本文提及的接口调用代码示例前,您需要先申请相应的API服务. 邮编查询:通过邮编查询地名:通过地名查询邮编 今日热门新闻查询:提 ...
- Web自动化框架LazyUI使用手册(7)--浏览器常用操作API
LazyUI框架中,BrowserEmulator类提供了大量的浏览器操作,常用的API列举如下: 1. 基本操作 /** * Open the URL * 打开一个URL * @param ur ...
- Java之Object类和常用的API
Object类和常用的API 学习过程中的笔记,涉及到Objetc中的equals方法和toString方法,日期类Date,日历类Calendar,日期格式化类SimpleDateFormat以及基 ...
- Atitit.常用语言的常用内部api 以及API兼容性对源码级别可移植的重要性 总结
Atitit.常用语言的常用内部api 以及API兼容性对源码级别可移植的重要性 总结 1.1. 要兼容的重要语言api1 1.2. 常用基础api分类 core api1 1.3. 比较常用的扩展库 ...
- 常用快递API及快递在线下单API分享
1.常用快递API 支持顺丰.EMS.申通.圆通.韵达.汇通.中通.天天.德邦.全峰等主流快递公司. 文档地址:https://www.juhe.cn/docs/api/id/43 1.1常用快递查询 ...
- jquery中最常用的API有哪些
jquery中最常用的API有哪些 一.总结 一句话总结:取html的方法,class相关的方法,val相关的方法,data相关的方法,attr相关的方法 1.jQuery Object Access ...
随机推荐
- 一个简单的Java程序例子以及其几种注释
在说道主题前,先来啰嗦两句,o()︿︶)o 唉,不说两句心里就有个疙瘩,也许这就是所谓的强迫症吧,好了说说我想啰嗦的,其实也就是这样子的,关于Java开发工具箱的下载以及环境的配置.Java开发工具箱 ...
- Hibernate 与 Spring 的整合
刚刚学习了hibernate和Spring的整合,现在来总结一下. 以实现一个功能为例,与大家分享一下整个过程. 需要实现的功能:建立一个Person类,该类包括name,sex,age,birtha ...
- swift 与 指针初级使用
swift 里面对应C 的基础类型前面加C,CInt.CBool和CChar UnsafePointer<CChar> 对应C的 const char *;常量指针不可变 UnsafeMu ...
- glibc strlen delphi pascal
From: Will DeWitt Jr. Subject: Fast strlen routine? NewsGroup: borland.public.delphi.language.basm D ...
- 编写你自己的单点登录(SSO)服务
王昱 yuwang881@gmail.com 博客地址http://yuwang881.blog.sohu.com 摘要:单点登录(SSO)的技术被越来越广泛地运用到各个领域的软件系统其中.本文从 ...
- 简单的新浪微博OAuth认证实现
System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY); System.setProperty(&q ...
- iOS开发——UI篇Swift篇&UIActivityIndicatorView
UIActivityIndicatorView override func viewDidLoad() { super.viewDidLoad() titleLabel.text = titleStr ...
- win7配置nginx+php步骤
1.下载nginx: http://www.nginx.cn/nginx-download 2.下载php : http://www.php.net/downloads.php (线程安全与非安全参 ...
- Android获取网页上的图片的代码
public Bitmap getWebBitmap(String imgUrl) { Bitmap bitmap =null; try { InputStream inputStream = nul ...
- LeetCode26 Remove Duplicates from Sorted Array
题目: Given a sorted array, remove the duplicates in place such that each element appear only once and ...