Skip to content

M_Cyjb_StringUtil_AsView_2

CYJB edited this page Mar 20, 2024 · 2 revisions

StringUtil.AsView 方法 (String, Int32, Int32)

创建指定字符串从指定索引开始的视图。

Namespace: Cyjb
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6

语法

C#

public static StringView AsView(
	this string? text,
	int start,
	int length
)

参数

 

text
Type: System.String
要创建视图的字符串。
start
Type: System.Int32
视图的起始索引。
length
Type: System.Int32
视图的长度。

返回值

Type: StringView
字符串的视图。

备注

在 Visual Basic 和 C# 中,这个方法可以当成为类型String的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic)扩展方法 (C# 编程指南) 获取更多信息。

Exceptions

 

异常 条件
ArgumentOutOfRangeException start 小于 0 或大于 text.Length
ArgumentOutOfRangeException start + length 表示的位置不在 text 范围内。

Remarks

如果 textnull,会返回空视图。

参见

Reference

StringUtil 类
AsView 重载
Cyjb 命名空间

Clone this wiki locally