HP Forums
Removing tag after units conversion - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Removing tag after units conversion (/thread-3567.html)



Removing tag after units conversion - John Colvin - 04-06-2015 07:02 PM

Does anyone know if there is a way to remove the units tag at the end of the number after converting from one unit to another. Example: 4.1244_in to 4.1244. I know I
can simply pull the number from the stack and edit out the tag, but I was hoping there might be a quicker, more convenient way of doing this.


RE: Removing tag after units conversion - DrD - 04-06-2015 07:49 PM

You could just divide by one unit:

12_in/1_in ==> 12


RE: Removing tag after units conversion - John Colvin - 04-06-2015 10:21 PM

(04-06-2015 07:49 PM)DrD Wrote:  You could just divide by one unit:

12_in/1_in ==> 12

That works. Thanks.


RE: Removing tag after units conversion - Joe Horn - 04-07-2015 02:14 AM

(04-06-2015 07:49 PM)DrD Wrote:  You could just divide by one unit:

12_in/1_in ==> 12

CAS.left(unit) is more cryptic but it also works, e.g. CAS.left(12_in) returns 12. One benefit of this method is that you don't need to know the unit; it strips off ANY unit or combination of units.


RE: Removing tag after units conversion - John Colvin - 04-07-2015 09:10 PM

(04-07-2015 02:14 AM)Joe Horn Wrote:  
(04-06-2015 07:49 PM)DrD Wrote:  You could just divide by one unit:

12_in/1_in ==> 12

CAS.left(unit) is more cryptic but it also works, e.g. CAS.left(12_in) returns 12. One benefit of this method is that you don't need to know the unit; it strips off ANY unit or combination of units.
Good solution Joe. I used the CAS method in my DTAG function for removing the units tag from the numerical result of a conversion on the 1st level stack.