Hex$
ResultString$ = Hex$(ValueToConvert)
 
Parameters:

    ValueToConvert = The value you wish to translate to a Hex string
Returns:

    ResultString$
 

      For those who are familiar with the Hexadecimal number system. Hex$ is a handy function that will take any integer value and convert it into a hex formatted string.



FACTS:


      * The created string will be in the form "$00000000"

      * Hex is base 16 number system, so each digit ranges from 0 to 15. Values 10,11,12,13,14,15 are represented using the A,B,C,D,E,F letters. So it's common to see Hex values that are mix of letters and numbers.

      * Hex is often used as way to representing ARGB colours. Examples. $000000ff = ARGB(0,0,0,255) , $0000ff00 = ARGB(0,0,255,0) , $00ff0000 = ARGB(0,255,0,0)

      * PlayBASIC compiler supports Hexadecimal literals, so you insert such values into your source code directly.





Mini Tutorial:


      How to display the hexadecimal representation of integer value.

  
  
  
  
  
; Display 255 in as hex
  Print Hex$(255)
  
; Display the values 0 through 16 in hex
  For lp=0 To 16
     Print Str$(lp)+" )="+Hex$(lp)
  Next
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  




This example would output.

  
  $000000ff
  0)=$00000000
  1)=$00000001
  2)=$00000002
  3)=$00000003
  4)=$00000004
  5)=$00000005
  6)=$00000006
  7)=$00000007
  8)=$00000008
  9)=$00000009
  10)=$0000000A
  11)=$0000000B
  12)=$0000000C
  13)=$0000000D
  14)=$0000000E
  15)=$0000000F
  16)=$00000010
  




 
Example Source: Download This Example
; -----------------------------------------
; Hex$ EXAMPLE
; -----------------------------------------
  
  
; Display the Hexadecimal String representation of the integer value 15
  Print Hex$(15)
  
; Display the Hexadecimal String representation of the integer value 255
  Print Hex$(255)
  
; Display the Hexadecimal String representation of the integer value 65535
  Print Hex$(65535)
  
  
; Show Us the Screen And Wait For Key Input before ending
  Sync
  WaitKe
 
Related Info: Bin$ | Digits$ | Literals | Str$ | Val :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com