String.Substring 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| Substring(Int32) |
回傳一個是該字串子串的子字串。 |
| Substring(Int32, Int32) |
回傳一個是該字串子串的子字串。 |
Substring(Int32)
回傳一個是該字串子串的子字串。
[Android.Runtime.Register("substring", "(I)Ljava/lang/String;", "")]
public string Substring(int beginIndex);
[<Android.Runtime.Register("substring", "(I)Ljava/lang/String;", "")>]
member this.Substring : int -> string
參數
- beginIndex
- Int32
起始索引,包含。
傳回
指定的子字串。
- 屬性
例外狀況
若 start 或 start > length()。
備註
回傳一個是該字串子串的子字串。 子字串從指定索引的字元開始,延伸至該字串的末尾。
範例: <blockquote>
"unhappy".substring(2) returns "happy"
"Harbison".substring(3) returns "bison"
"emptiness".substring(9) returns "" (an empty string)
</區塊引用>
Java 文件 java.lang.String.substring(int)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
Substring(Int32, Int32)
回傳一個是該字串子串的子字串。
[Android.Runtime.Register("substring", "(II)Ljava/lang/String;", "")]
public string Substring(int beginIndex, int endIndex);
[<Android.Runtime.Register("substring", "(II)Ljava/lang/String;", "")>]
member this.Substring : int * int -> string
參數
- beginIndex
- Int32
起始索引,包含。
- endIndex
- Int32
專屬的終結索引。
傳回
指定的子字串。
- 屬性
例外狀況
若 start , start > end 或 end > length()。
備註
回傳一個是該字串子串的子字串。 子串從指定的 beginIndex 開始,延伸至索引 endIndex - 1的字元。 因此子串的長度為 endIndex-beginIndex。
範例: <blockquote>
"hamburger".substring(4, 8) returns "urge"
"smiles".substring(1, 5) returns "mile"
</區塊引用>
Java 文件 java.lang.String.substring(int, int)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。