I wanted to know if I created a GUID correctly. GUID stands for Global Unique ID.
This is my code for an Alphabetical GUID
// create guid and display in textarea1
var x, r as integer
var guid, guid_with_hyphens as string
for x=1 to 16
// 65 is A
r = 65 + System.Random.InRange(0, 25)
guid =guid + chr(r)
select case x
case 4
guid_with_hyphens=guid_with_hyphens +chr(r)+ "-"
case 8
guid_with_hyphens=guid_with_hyphens +chr(r)+ "-"
case 12
guid_with_hyphens=guid_with_hyphens +chr(r)+ "-"
else
guid_with_hyphens=guid_with_hyphens+chr(r)
end select
next x
textarea1.Value =textarea1.Value + guid + EndOfLine
textarea1.Value =textarea1.Value + guid_with_hyphens + EndOfLine
textarea1.Value =textarea1.Value + " " + EndOfLine
And this is my code for an Alphanumeric GUID
// create Alphanumeric guid and display in textarea1
var x, r as integer
var s, guid, guid_with_hyphens as string
for x=1 to 16
r = System.Random.InRange(0, 34)
select case r
case 0
s="A"
case 1
s="B"
case 2
s="C"
case 3
s="D"
case 4
s="E"
case 5
s="F"
case 6
s="G"
case 7
s="H"
case 8
s="I"
case 9
s="J"
case 10
s="K"
case 11
s="L"
case 12
s="M"
case 13
s="N"
case 14
s="O"
case 15
s="P"
case 16
s="Q"
case 17
s="R"
case 18
s="S"
case 19
s="T"
case 20
s="U"
case 21
s="V"
case 22
s="W"
case 23
s="X"
case 24
s="Y"
case 25
s="Z"
case 26
s="1"
case 27
s="2"
case 28
s="3"
case 29
s="4"
case 30
s="5"
case 31
s="6"
case 32
s="7"
case 33
s="8"
case 34
s="9"
// 0 is to difficult to read if it is a 0 or a O
// case 35
// s="0"
end select
guid =guid + s
select case x
case 4
guid_with_hyphens=guid_with_hyphens + s + "-"
case 8
guid_with_hyphens=guid_with_hyphens + s + "-"
case 12
guid_with_hyphens=guid_with_hyphens + s + "-"
else
guid_with_hyphens=guid_with_hyphens + s
end select
next x
textarea1.Value =textarea1.Value + guid + EndOfLine
textarea1.Value =textarea1.Value + guid_with_hyphens + EndOfLine
textarea1.Value =textarea1.Value + " " + EndOfLine
Is it better to store the GUID as a string without dashes? I think it is easier to read with dashes.
What should the length of the GUID be? I used 16, should it be 20 or 24?
Also, in the alphanumeric GUID, I found that 0 and O were to hard to visually identify, so I deleted creating GUID’s with 0’s in them.
Hopefully someone finds this helpful.