StringSegment.Substring 方法

定义

重载

Substring(Int32)

从此 StringSegment 检索子字符串。Retrieves a substring from this StringSegment. 子字符串从 offset 指定的位置开始,并具有剩余长度。The substring starts at the position specified by offset and has the remaining length.

Substring(Int32, Int32)

从此 StringSegment 检索子字符串。Retrieves a substring from this StringSegment. 子字符串从 offset 指定的位置开始,并具有指定的 lengthThe substring starts at the position specified by offset and has the specified length.

Substring(Int32)

从此 StringSegment 检索子字符串。Retrieves a substring from this StringSegment. 子字符串从 offset 指定的位置开始,并具有剩余长度。The substring starts at the position specified by offset and has the remaining length.

public:
 System::String ^ Substring(int offset);
public string Substring (int offset);
member this.Substring : int -> string
Public Function Substring (offset As Integer) As String

参数

offset
Int32

StringSegment 中子字符串的起始字符位置(从零开始)。The zero-based starting character position of a substring in this StringSegment.

返回

String

一个 String,等效于在此 StringSegment 中从 offset 开始的剩余长度的子字符串A String that is equivalent to the substring of remaining length that begins at offset in this StringSegment

例外

offset 大于或等于 Length,或小于零。offset is greater than or equal to Length or less than zero.

适用于

Substring(Int32, Int32)

从此 StringSegment 检索子字符串。Retrieves a substring from this StringSegment. 子字符串从 offset 指定的位置开始,并具有指定的 lengthThe substring starts at the position specified by offset and has the specified length.

public:
 System::String ^ Substring(int offset, int length);
public string Substring (int offset, int length);
member this.Substring : int * int -> string
Public Function Substring (offset As Integer, length As Integer) As String

参数

offset
Int32

StringSegment 中子字符串的起始字符位置(从零开始)。The zero-based starting character position of a substring in this StringSegment.

length
Int32

子字符串中的字符数。The number of characters in the substring.

返回

String

一个 String,等效于在此 StringSegment 中从 offset 开始的长度为 length 的子字符串A String that is equivalent to the substring of length length that begins at offset in this StringSegment

例外

offsetlength 小于零,或 offset + length 大于 Lengthoffset or length is less than zero, or offset + length is greater than Length.

适用于