use regular expressionsRegex re = new Regex(@"\{([^}]+)\}");
MatchCollection mc = re.Matches(YourString);
string[] myArray = new string[mc.Count];for(int i=0; i < mc.Count; i++)
{
  myArray[i] = mc[i].Groups[1].Value;
}

解决方案 »

  1.   

    那么怎么用程序写出一个html文件呢?
      

  2.   

    don't understand you what you wantafter your replace the values for your 定义以{$开头和以}结尾的关键字, you can always use Response.Write to write out the content. If you want to save the content to a file, you can use classes in System.IO
      

  3.   

    就是 saucer(思归/MVP) 所讲的那样用 Regex类去解析html文档,以正则表达式为参数来解析“html中有些我自定义的关键字以{$开头和以}结尾,中间为任意字母或数字”,然后调用match方法返回匹配的字符串数组,接下来遍历,应该可以了吧。反正就是如 saucer(思归/MVP) 代码所示,就那样的。