M_Cyjb_CharUtil_Width_1 - CYJB/Cyjb GitHub Wiki

CharUtil.Width 方法 (String, Int32)

返回指定字符串中位于指定位置的字符的宽度。

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

语法

C#

public static int Width(
	string str,
	ref int index
)

参数

 

str
Type: System.String
要获取宽度的字符字符串。
index
Type: System.Int32
str 中的字符位置,并在方法调用之后设置为下一个字符位置, 会识别可能的 Unicode 代理项对。

返回值

Type: Int32
str 中指定字符的宽度,结果可能是 012

Exceptions

 

异常 条件
ArgumentNullException strnull
IndexOutOfRangeException index 大于等于字符串的长度或小于零。

Remarks

此方法基于 Unicode 标准 13.0.0 版。详情请参见 Unicode Standard Annex #11 EAST ASIAN WIDTH。 返回 0 表示控制字符、非间距字符或格式字符,1 表示半角字符, 2 表示全角字符。

参见

Reference

CharUtil 类
Width 重载
Cyjb 命名空间

Other Resources

Unicode Standard Annex #11 EAST ASIAN WIDTH

⚠️ **GitHub.com Fallback** ⚠️