<summary>
The URL field value is replaced, no field is added
</summary>
<param name= "Strrepsource" > Source to be changed url</param>
<param name= "Strrepfield" > field, note the distinction between uppercase and lowercase. such as: ID or key37</param>
<param name= "Strnewvalue" > New value </param>
<returns> New url</returns> after replacement
public static string Urlreplace (String Strrepsource, String Strrepfield, String strnewvalue)
{
System.Text.StringBuilder Strbuilder = new System.Text.StringBuilder ();
BOOL Bswitch = false;
if (Strrepsource.contains ("&" + Strrepfield + "="))
{
Strrepfield = "&" + Strrepfield + "=";
Bswitch = true;
}
else if (Strrepsource.contains ("?" + Strrepfield + "="))
{
Strrepfield = "?" + Strrepfield + "=";
Bswitch = true;
}
if (bswitch)
{
string[] Strarray = Strrepsource.split (new string[] {Strrepfield}, 2, stringsplitoptions.removeemptyentries);
Strbuilder.append (Strarray[0]);
Strbuilder.append (Strrepfield);
Strbuilder.append (Strnewvalue);
if (strarray.length = = 2 && strarray[1]. Contains ("&"))
{
string[] Stray = strarray[1]. Split (new char[] {' & '}, 2, stringsplitoptions.removeemptyentries);
Strbuilder.append ("&" + stray[stray.length-1]);
}
}
Else
{
Strbuilder.append (Strrepsource);
Strbuilder.append (' & ');
Strbuilder.append (Strrepfield);
Strbuilder.append (' = ');
Strbuilder.append (Strnewvalue);
}
return strbuilder.tostring ();
}
<summary>
The URL field value is replaced. No this field is added
</summary>
<param name= "Strrepsource" > Source to be changed url</param>
<param name= "Strrepfield" > field, note the distinction between uppercase and lowercase. such as: ID or key37</param>
<param name= "iNewValue" > New value </param>
<returns> New url</returns> after replacement
public static string Urlreplace (String Strrepsource, string strrepfield, int inewvalue)
{
Return Urlreplace (Strrepsource, Strrepfield, inewvalue.tostring ());
}
<summary>
URL constructor
</summary>
<param name= "strURL" > Original url</param>
<param name= "Stridfield" > Entity ID field </param>
<param name= "Iidvalue" >id value </param>
<param name= "Strjvalue" > select values. Implement the corresponding selection card sag </param>
<returns> constructed URL with Key37 and Key58 values added </returns>
public static string Urlstructure (string strurl, String Stridfield, String iidvalue, String strjvalue)
{
strURL = Urlreplace (strURL, Stridfield, Iidvalue);
strURL = Urlreplace (strURL, "Key37", Iidvalue);
strURL = Urlreplace (strURL, "Key58", Iidvalue);
if (!string. IsNullOrEmpty (Strjvalue))
{
strURL = Urlreplace (strURL, "J", Strjvalue);
}
return strurl;
}
<summary>
Join the number of references
</summary>
public static string addparameters (string url, String k, String v)
{
if (!string. IsNullOrEmpty (k))
{
url = urlreplace (URL, K, v);
}
return URL;
}
<summary>
URL constructor
</summary>
<param name= "strURL" > Original url</param>
<param name= "Stridfield" > Entity ID field </param>
<param name= "Iidvalue" >id value </param>
<returns> post-constructed URL. Inclusion of Key37 and Key58 values </returns>
public static string Urlstructure (string strurl, string stridfield, int iidvalue)
{
strURL = Urlstructure (strURL, Stridfield, Iidvalue.tostring (), String. Empty);
return strurl;
}
<summary>
URL constructor
</summary>
<param name= "strURL" > Original url</param>
<param name= "Stridfield" > Entity ID field </param>
<param name= "Iidvalue" >id value </param>
<returns> post-constructed URL. Inclusion of Key37 and Key58 values </returns>
public static string Urlstructure (string strurl, String Stridfield, String iidvalue)
{
strURL = Urlstructure (strURL, Stridfield, Iidvalue, String. Empty);
return strurl;
}
Sage Development URL Replacement string