yuanchaoyong

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

分类:

技术点:

相关文章:

  • 2021-11-28
  • 2021-05-09
  • 2021-08-16
  • 2021-12-21
  • 2022-03-02
  • 2022-01-23
  • 2022-03-07
  • 2022-01-06
猜你喜欢
  • 2022-12-23
  • 2022-02-06
  • 2022-01-02
  • 2021-12-11
  • 2022-01-17
  • 2021-08-17
相关资源
相似解决方案