UtilitiesDMSToDegrees Method

Convert a coordinate expressed in sexagesimal degrees to a double value (degrees)

Definition

Namespace: ASCOM.Tools
Assembly: ASCOM.Tools (in ASCOM.Tools.dll) Version: 3.0.0-rc.1+86c25ce733aebb4d8b1b8a62e84770ea5e972bea
C#
public static double DMSToDegrees(
	string DMSString
)

Parameters

DMSString  String
The coordinate expressed in sexagesimal notation (Degrees:Minutes:Seconds)

Return Value

Double
The supplied coordinate as a double value (degrees)

Remarks

Only the first three numeric components are considered, the remainder are ignored. Left to right positionally, the components are interpreted as degrees, minutes, and seconds. If only two components are present, they are assumed to be degrees and minutes, and if only one components is present, it is assumed to be degrees. Any components can have a fractional part.

Examples of valid input values: 127:27:45, 12:26, +345, -45:34:12

Examples of valid input values in a locale where point is used as the decimal separator: 60:27:45.846, 12:1.349, +345.1840746, -45:34:12.422

Examples of valid input values in a locale where comma is used as the decimal separator: 60:27:45,846, 12:1,349, +345,1840746, -45:34:12,422

Exceptions

InvalidValueExceptionIf the supplied coordinate contains an invalid character. Valid characters are: "+", "-", "0..9", ":" and "the decimal separator used by the current thread".

Version Information

.NET Standard

Supported in: 2.0

See Also