你可以用正则表达式:
你可以参考一下这个例子,主要是多了解正则表达式:
using System;
using System.Text.RegularExpressions;
namespace Samples {
public class RegExMatcher {
public static void Main(String[] args){
Regex digitregex = new Regex("(?<digit>[0-9])");
String before = "Here is so4848me te88xt with emb4493edded numbers.";
if ( args.Length > 0 ) {
before = String.Join(" ", args);
}