Jump to content

Recommended Posts

Posted

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

 

Posted (edited)
(defun is-hex-p (str)
  (wcmatch str "~*[~0-9a-fA-F]*")
)

 

Edited by Roy_043
Fixed hex range
  • Like 1
Posted (edited)

H is not valid hex...

Edited by Lee Mac
  • Like 1
Posted

Neither is G... Thanks. Fixed.

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...