Check if a GUID is formatted properly
Check if a GUID is formatted properly
API Declarations
' Author : Yannick Arekion
' Description : Determine if the value is a GUID
---
Rate Check if a GUID is formatted properly
(2(2 Vote))
Dim ch As String
Dim i As Integer
IsGUID = True
If Len(vGUID_IN) = 0 Then
IsGUID = False
ElseIf Left(vGUID_IN, 1) = "{" And Right(vGUID_IN, 1) = "}" Then
For i = 2 To 37
ch = Mid(vGUID_IN, i, 1)
If i = 10 Or i = 15 Or i = 20 Or i = 25 Then
If ch <> "-" Then
IsGUID = False
End If
Else
Select Case Asc(ch)
'Print Asc(ch)
Case 48 To 57 '0 -9
Case 65 To 90 'A to Z
Case 97 To 122 ' a - z
Case Else
IsGUID = False
End Select
End If
If IsGUID = False Then
i = 99
End If
Next
Else
IsGUID = False
End If
End Function
Check if a GUID is formatted properly Comments
No comments yet — be the first to post one!
Post a Comment