例如,我需要反转文本中的所有数字组
"test text 145 for 23 site 1"
Run Code Online (Sandbox Code Playgroud)
我们需要这个输出
"test text 541 fro 32 site 1"
Run Code Online (Sandbox Code Playgroud)
var replacedString =
Regex.Replace(//finds all matches and replaces them
myString, //string we're working with
@"\d+", //the regular expression to match to do a replace
m => new string(m.Value.Reverse().ToArray())); //a Lambda expression which
//is cast to the MatchEvaluator delegate, so once the match is found, it
//is replaced with the output of this method.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
233 次 |
| 最近记录: |