UnHex$: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
No edit summary  | 
				|||
| Line 4: | Line 4: | ||
====Comments and Examples====  | ====Comments and Examples====  | ||
The following example shows the relationship between HEX$ and UNHEX$:  | |||
 00010 print UNHEX$("+") ! the hexadecimal value which represents the "+" character  | |||
 00020 print  HEX$("2B") ! the character represented by the hexadecimal value "2B"  | |||
Output:  | |||
 2B  | |||
 +  | |||
UnHex$ can be used to examine the packed decimal representation (PD format) of a number written to an internal or external file.  | UnHex$ can be used to examine the packed decimal representation (PD format) of a number written to an internal or external file.  | ||
| Line 16: | Line 27: | ||
The above program will print the following:  | The above program will print the following:  | ||
  4.56 in PD 2.2 format is  - 456F  | |||
  4.56 in PD 2.2 format is  - 456F  | |||
  -4.56 in PD 2.2 format is  - 456D  |   -4.56 in PD 2.2 format is  - 456D  | ||
| Line 22: | Line 35: | ||
====Related Functions====  | ====Related Functions====  | ||
Inverse function is [[Hex$]].  | Inverse function is [[Hex$]].  | ||
Revision as of 09:19, 1 February 2012
UnHex$(A$)
The UnHex$ internal function converts A$ to hexadecimal representation.
Comments and Examples
The following example shows the relationship between HEX$ and UNHEX$:
00010 print UNHEX$("+") ! the hexadecimal value which represents the "+" character
00020 print  HEX$("2B") ! the character represented by the hexadecimal value "2B"
Output:
2B +
UnHex$ can be used to examine the packed decimal representation (PD format) of a number written to an internal or external file.
00010 OPEN #1: "name=billtest,replace,recl=4",INTERNAL,OUTIN,RELATIVE 00020 WRITE #1,USING 30,REC=1: 4.56, -4.56 00030 FORM 2*PD 2.2 00040 READ #1,USING 50,REC=1: A$, B$ 00050 FORM 2*C 2 00060 REREAD #1,USING 30: A, B 00060 PRINT A;"in PD 2.2 format is -"; UNHEX$(A$) 00070 PRINT B;"in PD 2.2 format is -"; UNHEX$(B$)
The above program will print the following:
4.56 in PD 2.2 format is - 456F
-4.56 in PD 2.2 format is - 456D
See the KStat$ function for another example of using UnHex$.
Related Functions
Inverse function is Hex$.