HexapiBackground.GpsExtensions.Longitude2Double C# (CSharp) Method

Longitude2Double() static private method

static private Longitude2Double ( this lon, string we ) : double
lon this
we string
return double
        internal static double Longitude2Double(this string lon, string we)
        {
            if (lon.Length < 2 || string.IsNullOrEmpty(we))
                return 0;

            var med = 0d;

            if (!double.TryParse(lon.Substring(3), out med))
                return 0;

            med = med / 60.0d;

            var temp = 0d;

            if (!double.TryParse(lon.Substring(0, 3), out temp))
                return 0d;

            med += temp;

            if (we.StartsWith("W"))
            {
                med = -med;
            }

            return Math.Round(med, 8);
        }