WikiCrawler/Utility/LicenseUtility.cs
/// <summary>
/// Parses a natural-language string into a country code.
/// </summary>
Parses a natural-language string into a country code.
Parses a natural - language string into a country code .
public static string ParseCountry(string location)
	{
		string[] split = location.Split(new string[] { "--" }, StringSplitOptions.RemoveEmptyEntries);
		switch (split[0].Trim().ToUpper())
		{
			case "AUSTRIA":
				return "AUT";
			case "CANADA":
				return "CAN";
			case "CHINA":
				return "CHN";
			case "DENMARK":
				return "DNK";
			case "ENGLAND":
			case "GREAT BRITAIN":
				return "GBR";
			case "FRANCE":
				return "FRA";
			case "GERMANY":
				return "DEU";
			case "ITALY":
				return "ITA";
			case "NETHERLANDS":
				return "NLD";
			case "RUSSIA":
				return "RUS";
			case "SWEDEN":
				return "SWE";
			case "SWITZERLAND":
				return "CHE";
			case "UNITED STATES":
			case "UNITES STATES":
				return "USA";
			default:
				throw new Exception("Failed to parse country '" + location + "'");
		}
	}
public static string ParseCountry ( string location ) { string [ ] split = location . Split ( new string [ ] { " " } , StringSplitOptions . RemoveEmptyEntries ) ; switch ( split [ 0 ] . Trim ( ) . ToUpper ( ) ) { case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : return " " ; case " " : case " " : return " " ; default : throw new Exception ( " " + location + " " ) ; } }
Parses a natural-language string into a country code.
Parses a natural - language string into a country code .
location
string