1、length()字符串长度

  String str="abc";

System.out.println(str.length());

//输出3

2、charAt()截取一个字符

3、equals() 和 equalsIgnoreCase()  

  比较两个字符串

4、toCharArray();//转变成字符数组

5、startsWith();endsWith();//前缀,后缀(开始,结束)

6、compareTo(); compareToIgnoreCase();

7、indexOf(); lastIndexOf();

  查询指定的字符或者子串第一次出现的位置

  查询指定的字符或者子串最后一次出现的位置

8、substring();

9、valueOf();转换为字符串

10、toLowerCase(); 转换为小写

  toUpperCase();转换为大写

String对象中常用的方法有哪些?的更多相关文章

  1. String对象中常用的方法

    String对象中常用的方法   1.charCodeAt方法返回一个整数,代表指定位置字符的Unicode编码.strObj.charCodeAt(index)说明:index将被处理字符的从零开始 ...

  2. String:(字符串)中常用的方法

    package stringyiwen; //字符串中常用的方法public class StringTest03 { public static void main(String[] args) { ...

  3. String类中常用的方法

    @Test public void demo(){ // 以下为String中的常用的方法及注释, 最常用的注释前有**标注 String s = "abcdefg123456"; ...

  4. String类中常用的方法(重要)

    1.字符串与字节 public String(byte[] byte); 将全部字节变成字符串 public String (byte[] byte,int offset,int length) 将部 ...

  5. Java中String类中常用的方法

    1.字符串与字符数组的转换 用toCharArray()方法将字符串变为字符数组 String str = "abcdef"; char c[] = str.tocharArray ...

  6. 27 string类中常用的方法列表

    1. 获取方法 int length()     获取字符串的长度 char charAt(int index) 获取特定位置的字符 (角标越界) int indexOf(String str) 获取 ...

  7. 2017.12.11 String 类中常用的方法

    1.编写程序将 "jdk" 全部变为大写,并输出到屏幕,截取子串"DK" 并输出到屏幕 package demo; import java.util.Scann ...

  8. js中关于string的一些常用的方法

    最近总结了一些关于string中的常用方法, 其中大部分的方法来自于<JavaScript框架设计>这本书, 如果有更好的方法,或者有关于string的别的常用的方法,希望大家不吝赐教. ...

  9. String对象的常用属性和方法

    属性 描述 length 在大多数情况下返回字符串中的字符数 方法 描述 toUpperCase() 将字符串修改为大写字母 toLowerCase() 将字符串修改为小写字母 charAt() 以索 ...

随机推荐

  1. js中Math.round、parseInt、Math.floor和Math.ceil小数取整总结(转)

    js中Math.round.parseInt.Math.floor和Math.ceil小数取整总结 Math.round.parseInt.Math.floor和Math.ceil 都可以返回一个整数 ...

  2. 6、git和github

    参考:http://www.cnblogs.com/qianmojing/p/6484162.htmlhttp://www.jb51.net/article/70729.htmhttp://www.c ...

  3. Cannot uninstall 'enum34'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

    更新tensorflow时遇到报错 Found existing installation: enum34 1.0.4Cannot uninstall 'enum34'. It is a distut ...

  4. 1.3 DVWA亲测sql注入漏洞

    LOW等级   我们先输入1 我们加上一个单引号,页面报错 我们看一下源代码: <?php if( isset( $_REQUEST[ 'Submit' ] ) ) { // Get input ...

  5. opencv头文件

    转载自:http://blog.csdn.net/aaron121211/article/details/51526901 1. .hpp文件是.h和.cpp文件在一起的2. #include < ...

  6. 利用MVC的Area作为二级域名

    此处使用的域名是我改了系统的hosts文件达到的 测试成功! 全局的注册方式 在Area的注册文件里进行配置 一个Area和一个外部的Controller 废话不多说,提供DEMO 下载地址

  7. 使用 jquery.webcam 进行asp.net 拍照

    HTML 代码 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index. ...

  8. python网络爬虫之requests库

    Requests库是用Python编写的HTTP客户端.Requests库比urlopen更加方便.可以节约大量的中间处理过程,从而直接抓取网页数据.来看下具体的例子: def request_fun ...

  9. Linux vim常用选项

    Vim命令 三种模式 Command Mode 命令模式 Insert Mode 插入模式 Last LineMode 底行模式 底行模式常用命令 :w 保存 :q 退出 :! + 命令 :! ls ...

  10. C++的STL总结(2)

    紧接着上篇博客,把没总结全的继续补充. (13)set容器 set是用红黑树的平衡二叉索引树的数据结构来实现的,插入时,它会自动调节二叉树排列,把元素放到适合的位置,确保每个子树根节点的键值大于左子树 ...