RepCad Posted June 22, 2020 Share Posted June 22, 2020 Hi all, I have a function to check if a string is hex or not in vba, can someone change or rewrite the function in autolisp? Public Function IsHex(strInput As String) As Boolean Dim i As Long IsHex = False If Len(strInput) = 0 Then Exit Function For i = 1 To Len(strInput) If Not (Mid$(strInput, i, 1) Like "[0-9a-hA-H]") Then Exit Function Next IsHex = True End Function Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted June 22, 2020 Share Posted June 22, 2020 (edited) (defun is-hex-p (str) (wcmatch str "~*[~0-9a-fA-F]*") ) Edited June 22, 2020 by Roy_043 Fixed hex range 1 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 22, 2020 Share Posted June 22, 2020 (edited) H is not valid hex... Edited June 22, 2020 by Lee Mac 1 Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted June 22, 2020 Share Posted June 22, 2020 Neither is G... Thanks. Fixed. 1 Quote Link to comment Share on other sites More sharing options...
RepCad Posted June 24, 2020 Author Share Posted June 24, 2020 Thank you both. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.