Hey guys..
Anyone got a bit of code/solution to getting a unique character string ??
No numerics or control chars allowed & I'm unable to keep track of the chars used in a particular order ?
Bit like rnd but for strings ??
Pee
Printable View
Hey guys..
Anyone got a bit of code/solution to getting a unique character string ??
No numerics or control chars allowed & I'm unable to keep track of the chars used in a particular order ?
Bit like rnd but for strings ??
Pee
Let me whip up some code for ya...brb
Code:Public Function GetRanString(ByVal iChars As Integer)
Dim x As Integer
Dim intRand As Integer
Dim strOut As String
Dim GotRand As Boolean
Randomize
For x = 1 To iChars
Do Until GotRand = True
intRand = Int((90 - 48 + 1) * Rnd + 48)
If InStr(1, "ABCDEFGH JK MN PQRSTUVWXYZ 23456789", Chr(intRand), 1) Then
GotRand = True
End If
Loop
strOut = strOut & Chr(intRand)
GotRand = False
Next
GetPassword = strOut
End Function
usageCode:function rndstr(iLen as integer ) as string
Dim i,str
Dim t as string
t="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
str=""
for i=1 to iLen
str = str & mid(t, Rnd*26 +1,1)
next
rndstr = str
end functionm
myrandomstring = rndstr(10) ' gives 10 chars back
Was that what you wanted?
My sequential spamming has been interupted! :D
I like the quote, and LOL thing too. Whaha clever, that's like a free post too! :cool:
I moved this thread to Chit Chat.
Please stop posting garbage in the General Vb forum just to up your counts. I don't want to have to take take more serious action then this warning.
Told you guys!!! :D :rolleyes: :(Quote:
Originally posted by MartinLiss
I moved this thread to Chit Chat.
Please stop posting garbage in the General Vb forum just to up your counts. I don't want to have to take take more serious action then this warning.