GenerateRandom

Generates a random string, returns string passed, then full date, then 8-chars random string
Like in wetfile-2018-09-12-TGR45R4A


Public

Tested

My Own Work
Public Function GenerateRandom(SystemText)
Dim sb As New StringBuilder
Dim r As New Random
Dim idx As Integer
Dim s As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
Randomize()
For i As Integer = 1 To 8
Randomize()
idx = r.Next(0, 35)
sb.Append(s.Substring(idx, 1))
Next
Dim cSuffixName As String = Hex(CLng(Now.Ticks))
Return SystemText & "-" & Format(Date.Today, "yyyy-MM-dd") & "-" & sb.ToString
End Function

SystemText

GenerateRandomFilename("wetfile")
returns
wetfile-2018-09-12-TGR45R4

Views 3682 Downloads 1391

VB.Net Texts + Strings
ANmarAmdeen
813
Attachments
Revisions

v1.0