String Control, stringcontrol
Using System; using System. collections. generic; using System. text; using System. web; using System. web. security; using System. web. UI; using System. web. UI. webControls; using System. web. UI. webControls. webParts; using System. web. UI. htmlControls; // using Microsoft. teamFoundation. workItemTracking. controls; namespace COMP {// <summary> /// string operation // </summary> public class StringControl {/// <summary> // client browser // juwen // /// </summary> /// <param name = "strClient"> client environment </param> /// <param name = "ver"> browser version </param> /// <returns> returns the browser name </returns> public string getBrowser (string strClient, out string ver) {// Camino string strBrowser = null; if (strClient. contains ("MSIE") = true) {strBrowser = "Internet Explorer"; ver = getIEVer (strClient);} else if (strClient. contains ("Opera") = true) {strBrowser = "Opera"; ver = getBrowserVer (strClient, "Version");} else if (strClient. contains ("Camino") = true) // to be verified {strBrowser = "Camino"; ver = getBrowserVer (strClient, "Version");} else if (strClient. contains ("Firefox") = true) & (strClient. contains ("Chrome") = false) & (strClient. contains ("Safari") = false) & (strClient. contains ("Navigator") = false) {strBrowser = "FireFox"; ver = getBrowserVer (strClient, "Firefox");} else if (strClient. contains ("AppleWebKit") = true) & (strClient. contains ("Chrome") = true) & (strClient. contains ("Safari") = true) & (strClient. contains ("Flock") = false) {strBrowser = "Google Chrome"; ver = getBrowserVer (strClient, "Chrome");} else if (strClient. contains ("Firefox") = true) & (strClient. contains ("Chrome") = false) & (strClient. contains ("Safari") = false) & (strClient. contains ("Navigator") = true) {strBrowser = "Netscape Navigator"; ver = getBrowserVer (strClient, "Navigator");} else if (strClient. contains ("AppleWebKit") = true) & (strClient. contains ("Flock") = true) & (strClient. contains ("Chrome") = true) & (strClient. contains ("Safari") = true) {strBrowser = "Flock"; ver = getBrowserVer (strClient, "Flock");} else if (strClient. contains ("AppleWebKit") = true) & (strClient. contains ("Chrome") = false) & (strClient. contains ("Safari") = true) {strBrowser = "Safari"; ver = getBrowserVer (strClient, "Version");} else {strBrowser = "NoData "; ver = "NoData";} return strBrowser ;} /// <summary> /// client operating system /// </summary> /// <param name = "strClient"> client environment </param> /// <returns> return OS name </returns> public string getPlatform (string strClient) {string OpertorSystem = String. empty; if (strClient. contains ("Mac") = true) {return OpertorSystem = "Mac";} else if (strClient. contains ("Unix") = true) {return OpertorSystem = "Unix";} else if (strClient. contains ("Linux") = true) {return OpertorSystem = "Linux";} else if (strClient. contains ("SunOS") = true) {return OpertorSystem = "SunOS";} else if (strClient. contains ("Windows NT 3.1") = true) {return OpertorSystem = "Windows NT 3.1";} else if (strClient. contains ("Windows NT 3.5") = true) {return OpertorSystem = "Windows NT 3.5";} else if (strClient. contains ("Windows NT 3.51") = true) {return OpertorSystem = "Windows NT 3.51";} else if (strClient. contains ("Windows NT 4.0") = true) {return OpertorSystem = "Windows NT 4.0";} else if (strClient. contains ("95") = true) {return OpertorSystem = "Windows 95";} else if (strClient. contains ("Me") = true) {return OpertorSystem = "Windows Me";} else if (strClient. contains ("98") = true) {return OpertorSystem = "Windows 98";} else if (strClient. contains ("Windows NT 5.0") = true) {return OpertorSystem = "Windows 2000";} else if (strClient. contains ("Windows NT 5.1") = true) {return OpertorSystem = "Windows XP/Windows Fundamentals";} else if (strClient. contains ("Windows NT 5.2") = true) {return OpertorSystem = "Windows Server 2003/Windows Home Server";} else if (strClient. contains ("Windows NT 6.0") = true) {return OpertorSystem = "Windows Vista/Windows Server 2008";} else if (strClient. contains ("Windows NT 6.1") = true) {return OpertorSystem = "Windows 7/Windows Server 2008 R2";} else {return OpertorSystem = "NoData ";} // OpertorSystem ;} /// <summary> /// IE /// </summary> /// <param name = "strClient"> </param> /// <returns> </ returns> private string getIEVer (string strClient) {string ver = string. empty; if (strClient. contains ("MSIE 9.0") = true) {return ver = "9.0";} if (strClient. contains ("MSIE 8.0") = true) {return ver = "8.0";} else if (strClient. contains ("MSIE 7.0") = true) {return ver = "7.0";} else if (strClient. contains ("MSIE 6.0") = true) {return ver = "6.0";} else if (strClient. contains ("MSIE 5.0") = true) {return ver = "5.0" ;}else {return ver = "1.0 ";}} /// <summary> /// get the version /// </summary> /// <param name = "strClient"> client environment </param> /// <param name = "browere"> browser name </param> // <returns> returns the version number </returns> private string getBrowserVer (string strClient, string browere) {string ver = string. empty; string [] words = strClient. split (''); string browsername = string. empty; foreach (string word in words) {if (word. contains (browere) = true) {browsername = word;} // Response. write (word + "<br/>");} // Response. write ("browser name and version:" + browsername + "<br>"); string strnamd = ""; // string strver = ""; string [] wd = browsername. split ('/'); foreach (string nd in wd) {if (nd. contains (browere) = true) {strnamd = nd;} else {ver = nd;} return ver ;} /// <summary> /// browser language /// </summary> /// <param name = "strClicent"> client environment </param> /// <returns> return browsing language </returns> public string getBrowserLanguage (string strClicent) {// zh-tw Chinese (Taiwan) zh-cn Chinese (PRC) // zh-hk Chinese (Hong Kong SAR) zh-sg Chinese (Singapore) string BroswerLanguage = string. empty; strClicent = strClicent. toLower (); if (strClicent. contains ("zh-cn") = true) {return BroswerLanguage = "zh-cn";} if (strClicent. contains ("zh-tw") = true) {return BroswerLanguage = "zh-tw";} if (strClicent. contains ("zh-hk") = true) {return BroswerLanguage = "zh-hk";} if (strClicent. contains ("zh-sg") = true) {return BroswerLanguage = "zh-sg";} else if (strClicent. contains ("en-us") = true) {return BroswerLanguage = "en-US";} else {return BroswerLanguage = "NoData ";}}}}
Whether the string is a few or not
1. Wire; thin rope; strap [U] [C]
I need a piece of string to tie this parcel up.
I need a thin rope to tie the package up.
2. Tape (attached to clothes), ribbon [C]
3. A string of cables (such as beads and money) and strings [C]
4. A string, a row, and a column [C] [(+ of)]
A string of accidents happened at that corner.
A series of accidents occurred at that corner.
The monk wears a string of beads.
The monk wore a string of beads.
5. (plant) fiber, tendon [C]
6. [C]
There are four strings on a violin.
The violin has four strings.
It can be seen that the first meaning is "wire; thin rope; strap [U] [C]"
Not a few
All other meanings can be counted
How does aspnet convert the string type to the control type?
Button btn = this. Page. FindControl ("Button ID") as Button;
If (btn! = Null)
{
...
}