_IsHex() - Checks if a string is a hexadecimal value.


SUBMITTED BY: Guest

DATE: May 29, 2013, 7:13 a.m.

FORMAT: Text only

SIZE: 962 Bytes

HITS: 1064

  1. #include <Constants.au3>
  2. MsgBox($MB_SYSTEMMODAL, '', '0xFFFF00: ' & _IsHex('0xFFFF00'))
  3. MsgBox($MB_SYSTEMMODAL, '', '0XGHXX190: ' & _IsHex('0XGHXX190'))
  4. ; #FUNCTION# ====================================================================================================================
  5. ; Name ..........: _IsHex
  6. ; Description ...: Checks if a string is a hexadecimal value.
  7. ; Syntax ........: _IsHex($sString)
  8. ; Parameters ....: $sString - A hexadecimal string.
  9. ; Return values .: Success - True
  10. ; Failure - False
  11. ; Author ........: guinness
  12. ; Example .......: Yes
  13. ; ===============================================================================================================================
  14. Func _IsHex($sString)
  15. ConsoleWrite($sString & @CRLF)
  16. Return StringRegExp($sString, '(?i:^0x[0-9a-f]+$)') = 1 ; Or the group class [:xdigit:].
  17. EndFunc ;==>_IsHex

comments powered by Disqus