博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java.lang.String
阅读量:4351 次
发布时间:2019-06-07

本文共 1074 字,大约阅读时间需要 3 分钟。

java.lang.String

    char charAt(int index)
        返回index索引位的字符。
    int compareTo(String other)
        对比两个字符串,按照字典顺序,若字符串在other之前,返回一个负数;若字符串在other之后,返回一个负数;若相等,返回0。
    int indexOf(String str)
    int indexOf(String str,int fromIndex)
        返回与字符串str匹配的第一个字串的开始位置,这个位置从索引0或fromIndex开始计算,若不存在str,返回-1。
    int lastIndexOf(String str)
    int lastIndexOf(String str,int fromIndxe)
        返回与字符串str匹配的最后一个字串的开始位置,这个位置从索引0或fromIndex开始计算,若不存在str,返回-1。
    int length()
        返回字符串的长度。
    boolean endsWith(String suffix)
        若字符串以suffix结尾,返回true。
    boolean startsWith(String prefix)
        若字符串以prefix结尾,返回true。
    boolean equals(Object other)
        若字符串与other相等,返回true。
    boolean equalsIgnoreCase(String other)
        若字符串与other相等(忽略大小写),返回true。
    String replace(CharSequence oldString,CharSequence newString)
        用newString替换原始字符串中的oldString,可以用String或StringBuffer对象作为CharSequence参数。
    String substring(int beginIndex)
    String substring(int beginIndex,int endIndex)
        截取原始字符串中从beginIndex(包含)到末尾或endIndex(不包含)的所有字符。
    String trim()
        删除原始字符串头部和尾部的空格。
    String toLowerCase()
        将原始字符串中所有大写字母改成小写字母。
    String toUpperCase()
        将原始字符串中的所有小写字母改成大写字母。
   

转载于:https://www.cnblogs.com/it-mh/p/10346273.html

你可能感兴趣的文章
[转载]EXTJS学习
查看>>
SQL Server2012完全备份、差异备份、事务日志备份和还原操作
查看>>
Flash动画播放
查看>>
springmvc+mybatis+dubbo+zookeeper 分布式架构
查看>>
HDUOJ-----Computer Transformation
查看>>
HDUOJ-----2838Cow Sorting(组合树状数组)
查看>>
自定义控件之---抽屉式弹窗控件.
查看>>
一款纯css3实现的机器人看书动画效果
查看>>
加班与效率
查看>>
轻量级Modal模态框插件cta.js
查看>>
MyEclipse下SpringBoot+JSP整合过程及踩坑
查看>>
重定向和管道
查看>>
实验五
查看>>
STL学习笔记(第二章 C++及其标准程序库简介)
查看>>
Operator_countByValue
查看>>
Java 日期往后推迟n天
查看>>
Web应用漏洞评估工具Paros
查看>>
Git 和 Github 使用指南
查看>>
20180925-4 单元测试
查看>>
mysql的数据存储
查看>>