January 7, 201115 yr File Name: Sexagesimal Expression s Evaluator File Submitter: raybaudi File Submitted: 07 Jan 2011 File Category: Samples FM Version: 9 A simple sexagesimal expression's evaluator. Click here to download this file
January 7, 201115 yr Nice. Two suggestions: rest = Mod ( adj ; 3600 ) ; Result = Time ( degrees ; minutes ; seconds )
January 7, 201115 yr Author Thank you. I could take your first suggestion, but why the second ? 0° will be 0:00:00 ( or am I blind ? )
January 7, 201115 yr Because it is an accepted format to express a sexagesimal value - and also because the result remains usable for further calculations. And - I forgot to mention - you could let the Time function do all the work, i.e. Time ( 0 ; 0 ; adj ) BTW, you can do this even with your text result, e.g. Hour ( adj ) & "°" & ...
January 7, 201115 yr Author This is a nice suggestion ! So I end up with: Let([ adj = "(" & Substitute ( TrimAll ( input ; 1 ; 3 ) ; [ ¶ ; "" ] ; [ "-" ; ")-("] ; [ "+" ; ")+("] ; [ "*" ; ")*(" ] ; [ "/" ; ")/("] ; [ "x" ; ")*(" ] ; [ ":" ; ")/("]) & ")" ; adj = Mod ( Evaluate ( Substitute ( adj ; [ "()" ; ""] ; [ "°" ; "*3600 "] ; [ "'" ; "*60 "] ; [ "\"" ; " "] ;[ " " ; "+"] ; [ "+)" ; ")" ] ) ) ; 360*3600 ) ]; Hour ( adj ) & "°" & If ( Minute ( adj ) ; Minute ( adj ) & "'" ) & If ( Seconds ( adj ) ; Seconds ( adj ) & "\"" ) ) BTW: I wished to use the List ( ) function in the result ( to get only not empty values ), but could not find a way.
Create an account or sign in to comment