Difference between revisions of "HexUtils Object"

From Hubitat Documentation
Jump to: navigation, search
(Created page with "==Description== The package name of this class is hubitat.helper. So to use in an App or Driver you would reference it with hubitat.helper.HexUtils. == <code>integerToHexStr...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
==Description==
 
The package name of this class is hubitat.helper.  So to use in an App or Driver you would reference it with hubitat.helper.HexUtils.
 
  
== <code>integerToHexString</code> ==
+
<big>'''We're moving!''' Please visit http://docs2.hubitat.com for the latest documentation.</big>
Convert integer value to hex string.
 
  
'''Signature'''
+
<big>
String integerToHexString(int value, int minBytes)
+
This document is available at: http://docs2.hubitat.com/en/developer/hexutils-object
 
+
</big>
'''Parameters'''
 
 
 
value - the integer value to encode
 
minBytes - the minmum number of hex encoded bytes, must be greater than 0
 
 
 
'''Returns'''
 
 
 
The value of the integer encoded as a hex string.
 
 
 
'''Example'''
 
int i = 5
 
def hexStr = hubitat.helper.HexUtils.integerToHexString(i, 1)
 
 
 
 
== <code>hexStringToInt</code> ==
 
Convert hex string to integer.
 
 
 
'''Signature'''
 
int hexStringToInt(String value)
 
 
 
'''Parameters'''
 
 
 
value - the hex string to convert
 
 
 
'''Returns'''
 
 
 
The integer value represented by the hex string.
 
 
 
'''Example'''
 
def myInt = hubitat.helper.HexUtils.hexStringToInt("01A6")
 
 
 
 
 
== <code>byteArrayToHexString</code> ==
 
Convert a byte array to hex string.
 
 
 
'''Signature'''
 
String byteArrayToHexString(byte[] value)
 
 
 
== <code>hexStringToByteArray</code> ==
 
Convert a hex string to a byte array.
 
 
 
'''Signature'''
 
byte[] hexStringToByteArray(String value)
 
 
 
== <code>intArrayToHexString</code> ==
 
Convert an integer array to a hex string.
 
 
 
'''Signature'''
 
String intArrayToHexString(int[] value)
 
 
 
== <code>hexStringToIntArray</code> ==
 
Convert a hex string into an integer array.
 
 
 
'''Signature'''
 
int[] hexStringToIntArray(String value)
 

Latest revision as of 04:08, 25 September 2022

We're moving! Please visit http://docs2.hubitat.com for the latest documentation.

This document is available at: http://docs2.hubitat.com/en/developer/hexutils-object