HP Forums

Full Version: Removing tag after units conversion
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
You could just divide by one unit:

12_in/1_in ==> 12
(04-06-2015 07:49 PM)DrD Wrote: [ -> ]You could just divide by one unit:

12_in/1_in ==> 12

That works. Thanks.
(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.
(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.
Reference URL's