Skip to content

M_Cyjb_StringUtil_UnicodeEscape

CYJB edited this page Mar 20, 2024 · 13 revisions

StringUtil.UnicodeEscape 方法 (StringView, Boolean)

返回当前字符串视图的 Unicode 转义字符串。

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

语法

C#

public static StringView UnicodeEscape(
	this StringView view,
	bool escapeVisibleUnicode = true
)

参数

 

view
Type: Cyjb.StringView
要进行转义的字符串视图。
escapeVisibleUnicode (Optional)
Type: System.Boolean
是否转义可见的 Unicode 字符,默认为 true

返回值

Type: StringView
转义后的字符串。

备注

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

Remarks

对于 ASCII 可见字符(从 0x20 空格到 0x7E ~ 符号),不会发生改变。

对于某些特殊字符(\0, , \a, \b, \f, \n, \r, \t, \v),会替换为其转义形式。

对于其它字符,会替换为其十六进制转义形式(\u0000)。

参见

Reference

StringUtil 类
UnicodeEscape 重载
Cyjb 命名空间

Clone this wiki locally