Skip to content

M_Cyjb_StringUtil_ReplacePattern

CYJB edited this page Jan 16, 2023 · 13 revisions

StringUtil.ReplacePattern 方法 (String, String, String)

使用指定的字符串替换与指定正则表达式模式匹配的所有字符串。

Namespace: Cyjb
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.11

语法

C#

public static string? ReplacePattern(
	this string? text,
	string pattern,
	string replacement
)

参数

 

text
Type: System.String
要搜索匹配项的字符串。
pattern
Type: System.String
要匹配的正则表达式模式。
replacement
Type: System.String
替换字符串。

返回值

Type: String
被替换后的新字符串。

备注

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

参见

Reference

StringUtil 类
ReplacePattern 重载
Cyjb 命名空间

Clone this wiki locally