您的位置:首页 > 编程语言 > C#

如何取得双引号内的字符串(C#)

2011-02-16 13:44 260 查看
一个字符串中带有双引号,如何获取到双引号内的字符串呢?

例如string words="hello\"world\"";要获取到"world"

using System.Text.RegularExpressions;

string words = "hello\"world\"";
Regex regex = new Regex("\"[^\"]*\"");
string result = regex.Match(words).Value.Replace("\"", "");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: