qq_36769031 2019-05-23 19:15 采纳率: 0%
浏览 280

VB的函数拿到C#来用除了问题怎么解决?

先看VB的代码:Dim int1, int2 As Integer

            int1 = InStr(MyHttp.Html, "name=" + Chr(34) + "securityId" + Chr(34))
            int1 = InStr(int1, MyHttp.Html, "value=")
            int1 = InStr(int1, MyHttp.Html, Chr(34)) + 1
            int2 = InStr(int1, MyHttp.Html, Chr(34))
            securityId = Mid(MyHttp.Html, int1, int2 - int1)
            securityId = MyHttp.utf8(securityId)

            int1 = InStr(MyHttp.Html, "name=" + Chr(34) + "_form_token" + Chr(34))
            int1 = InStr(int1, MyHttp.Html, "value=")
            int1 = InStr(int1, MyHttp.Html, Chr(34)) + 1
            int2 = InStr(int1, MyHttp.Html, Chr(34))
            _form_token = Mid(MyHttp.Html, int1, int2 - int1)

然后在看看C#的代码:
 int1 = MyHttp.Html.IndexOf("action=");
                int1 = InStr(int1, MyHttp.Html, Convert.ToChar(34)) + 1;
                int2 = InStr(int1, MyHttp.Html, Convert.ToChar(34));
                action = MyHttp.Html.Substring( int1, int2 - int1);

                int1 = MyHttp.Html.IndexOf( "name=" + Convert.ToChar(34) + "epccGwMsg" + Convert.ToChar(34));
                int1 = InStr(int1, MyHttp.Html, "value=");
                int1 = InStr(int1, MyHttp.Html, Convert.ToChar(34)) + 1;
                int2 = InStr(int1, MyHttp.Html, Convert.ToChar(34));
                epccGwMsg = MyHttp.Html.Substring(int1, int2 - int1);
  • 写回答

1条回答 默认 最新

  • threenewbee 2019-05-23 19:52
    关注

    你这代码是机器自动翻译的?
    InStr对应的是IndexOf,你第一个对了,后面的怎么就没有翻译对呢。

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)