M_Cyjb_CharUtil_Width_1 - CYJB/Cyjb GitHub Wiki
返回指定字符串中位于指定位置的字符的宽度。
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 中指定字符的宽度,结果可能是 0
、1
或 2
。
异常 | 条件 |
---|---|
ArgumentNullException |
str 为 null 。 |
IndexOutOfRangeException | index 大于等于字符串的长度或小于零。 |
此方法基于 Unicode 标准 13.0.0 版。详情请参见 Unicode Standard Annex #11 EAST ASIAN WIDTH。 返回 0
表示控制字符、非间距字符或格式字符,1
表示半角字符, 2
表示全角字符。