System.TimeZoneInfo.TrimSpecial C# (CSharp) Method

TrimSpecial() private static method

Needed to trim misc garbage in MS registry keys
private static TrimSpecial ( string str ) : string
str string
return string
		private static string TrimSpecial (string str)
		{
			if (str == null)
				return str;
			var Istart = 0;
			while (Istart < str.Length && !char.IsLetterOrDigit(str[Istart])) Istart++;
			var Iend = str.Length - 1;
			while (Iend > Istart && !char.IsLetterOrDigit(str[Iend]) && str[Iend] != ')') // zone name can include parentheses like "Central Standard Time (Mexico)"
				Iend--;
			
			return str.Substring (Istart, Iend-Istart+1);
		}