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();

  • 相关阅读:
    sublime Text 正则替换
    sublime Text 正则替换
    C# 解析 sln 文件
    PHP array_flip() 函数
    PHP array_filter() 函数
    PHP array_fill_keys() 函数
    PHP array_fill() 函数
    PHP array_diff_ukey() 函数
    51nod1355 斐波那契的最小公倍数
    C# 解析 sln 文件
  • 原文地址:https://www.cnblogs.com/yinhua7896/p/6986115.html
Copyright © 2011-2022 走看看