zoukankan      html  css  js  c++  java
  • 字符串

    字符串常用提取方法:

    1.public  int  indexof(int  ch)                        搜索第一个出现的

    2.public  int  indexof(String   value)          字符ch或字符串value

    3.public  int  lastindexof(int   ch)              搜索最后一个出现的

    4.public  int  lastindexof(String  value)      字符ch或字符串value

    5.public  String  subString(int  index)        提取从位置索引开始的字符串部分

    6.public  String  subString(int  beginindex,int  endindex)提取begainindex和endindex之间的字符串部分

    7.public  String trim()                              返回一个前后不含任何空格的调用字符串的副本

    注意:

           beginindex:字符串的位置从0开始算

           endindex:字符串的位置从1开始算

    String提供的操作字符串的方法:

    a:获得字符串的长度:length();

    b:比较字符串:equals();

    c:连接字符串:concat();

    d:提取字符串:subString();

    e:搜索字符串:indexof();

    f:拆分字符串:split();

    StringBuffer类提供的方法:

    a:转换成String类型:toString();

    b:连接字符串:append();

    c:插入字符串:insert();

      

  • 相关阅读:
    ubuntu下ssh服务相关操作
    搜索引擎的基础-倒排索引
    mysql重置密码
    mysql 服务器配置
    Activiti如何替换已部署流程图
    循环select查询结果集
    存储过程范例,有输入输出参数,带回滚
    sql server中字符串无法替换空格的问题
    Myeclipse实用快捷键总结
    Linux中添加用户与删除用户
  • 原文地址:https://www.cnblogs.com/pohuaiwang/p/6837729.html
Copyright © 2011-2022 走看看