度分秒转化成弧度的函数代码
问题描述:
度分秒转化成弧度的函数代码
Public Function RAD(ByVal DEGREE As String) As Double
Dim G As String
Dim G1 As Double
Dim d As Boolean
Dim DEG11 As Double
Dim DEG12 As Double
Dim DEG13 As Double
DEGREE = DEGFORMAT(DEGREE)
G = Left(Trim(Left(DEGREE, 3)), 1)
If G = "-" Then
G1 = -1
ElseIf G = "+" Then
G1 = 1
Else
G1 = 1
End If
DEG11 = Abs(Val(Left(DEGREE, 4)))
DEG12 = Val(Mid(DEGRE, 6, 2))
DEG12 = Val(Mid(DEGRE, 6, 2)) / 60
DEG13 = Val(Right(DEGREE, Len(DEGREE) - 8)) / 3600
RAD = G1 * (DEG11 + DEG12 + DEG13) * PI() / 180
End Function
上面这段代码里面,DEGREE = DEGFORMAT(DEGREE)这一句是什么意思?怎么理解?
答
DEGREE = DEGFORMAT(DEGREE)
这是一个赋值语句,就是把DEGREE作为函数 DEGFORMAT的参数,调用DEGFORMAT,最后把得到的值赋给DEGREE