zoukankan      html  css  js  c++  java
  • 注意:String类的substring()方法

    substring

    public String substring(int beginIndex,
                            int endIndex)
    返回一个新字符串,它是此字符串的一个子字符串。该子字符串从指定的 beginIndex 处开始,直到索引
    endIndex - 1的字符。因此,该子字符串的长度为 endIndex-beginIndex

    示例:

     "hamburger".substring(4, 8) returns "urge"
     "smiles".substring(1, 5) returns "mile"
    
    参数:
    beginIndex - 起始索引(包括)。
    endIndex - 结束索引(不包括)。
    返回:
    指定的子字符串。
    抛出:
    IndexOutOfBoundsException
    - 如果 beginIndex 为负,或 endIndex 大于此 String
    对象的长度,或 beginIndex 大于 endIndex


    /**************************************************************************
                      原文来自博客园——Submarinex的博客: www.cnblogs.com/submarinex/               
      *************************************************************************/

  • 相关阅读:
    Mobile phones(poj1195)
    Matrix(poj2155)
    1080
    1266
    codeforces626D . Jerry's Protest
    字符串格式化
    附加MySQL数据库的方法
    avaScript中变量的声明和赋值
    选择法排序
    JavaScript中变量的类型
  • 原文地址:https://www.cnblogs.com/submarinex/p/2062295.html
Copyright © 2011-2022 走看看