本文介绍了Fiddler/Jscript.NET:如何将字符串附加到特定的搜索查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面代码的问题是它在 URL 的最后附加了字符串

The problem with the below code is that it appends string at the very end of the URL

if (oSession.uriContains("search?q="))
    {
        var str = oSession.fullUrl;
        var sAppend = "+test1+test2+test3";
        if (!oSession.uriContains(sAppend))
        {
            oSession.fullUrl = str + sAppend;
        }
    }

那么,如何有条件地将 +test1+test2+test3 放在 search?q= 旁边?

So, How can I conditionally place +test1+test2+test3 right next to search?q= ?

谢谢

推荐答案

replace函数有什么问题:

What's the problem with replace function:

if (oSession.uriContains("search?q="))
    {
        var str = oSession.fullUrl;
        var sAppend = "+test1+test2+test3";
        if (!oSession.uriContains(sAppend))
        {
            oSession.fullUrl = str.replace( "search?q=","search?q="+sAppend);
        }
    }

这篇关于Fiddler/Jscript.NET:如何将字符串附加到特定的搜索查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 15:50