【发布时间】:2011-12-24 18:19:09
【问题描述】:
我聘请了一名编码员用 Regex 对我进行编码。问题是他是用 Visual Basic 编写的,而我需要它是用 C# 编写的。
我尝试使用转换器,但没有解决问题。
介意帮我将以下正则表达式转换为 C# 吗?问题在于 GetBetween 和 Strings 谢谢:
string iamtwit = ss("http://www.mailinator.com" + GetBetween(GetBetween(iamtwit1, matches.ToString(), "</a>"), "<a href=", ">"));
和
MessageBox.Show(GetBetween(matches1.ToString(), "<a href=\"", Strings.Chr(34)));
这里是原始代码:
Dim iamtwit As String = ss("http://www.mailinator.com" & GetBetween(GetBetween(iamtwit1, matches.ToString, "</a>"), "<a href=", ">"))
MsgBox(GetBetween(matches1.ToString, "<a href=""", Chr(34)))
我收到的错误消息是:
当前上下文中不存在名称“GetBetween”
当前上下文中不存在名称“字符串”
【问题讨论】:
-
那是 C#...注意分号?请发布 VB.NET 代码,以便我们准确了解发生了什么。
-
但我收到一条错误消息:GetBetween
-
GetBetween 是一个函数...可能还需要从VB.NET代码转换过来
-
@DanAndrews - 为什么需要转换?它必须在引用的程序集中才能工作。
-
@Oded,如果它在他试图转换的类中。 Ash 也是对的。