zoukankan      html  css  js  c++  java
  • String的substring()用于截取字符串

    substring() 用于返回一个字符串的子字符串,即截取字符串功能。

    substring()常用的重载方法如下:

    substring(int beginIndex,int endIndex) 意思为返回下标从beginIndex开始(包括),到endIndex(不包括)结束的子字符串。

                   eg: String str = "http://www.oracle.com";

                           String subStr = str.substring(11, 17);

                           System.out.println(subStr); // oracle

    substring(int beginIndex) 意思为返回下标从beginIndex开始(包括),到字符串结尾的子字符串。

                 eg: String str "http://www.oracle.com";

                           String subStr = str.substring(7);

                          System.out.println(subStr); // www.oracle.com

  • 相关阅读:
    [ZJOI2014]力
    [八省联考2018]劈配
    [APIO2007]动物园
    [九省联考2018]IIIDX
    [HAOI2015]树上染色
    [SHOI2008]堵塞的交通
    暑假第五周
    暑假第四周
    暑假第三周
    暑假第二周
  • 原文地址:https://www.cnblogs.com/sunfenqing/p/7457514.html
Copyright © 2011-2022 走看看