devxlogo

A Smart ID Generator

A Smart ID Generator

I wrote a unique error-proof number generator that greatly simplifies the checking of clients’ accountnumbers or other IDs used by your application. I use it in conjunction with the CheckForValid functions.For example, the CheckForValid returns True for number “203931.” The CheckFor Valid returns False fornumber “209331.”

 Function CheckForValid(Num As Long) _        As Boolean' Check for valid numberResult = Num Mod 13   If Result <> 0 Then        CheckForValid = False         ' if false then the number is wrongElse        CheckForValid = True        'if true the number is OKEnd IfEnd FunctionFunction Generate(Num As Long) As Long'Generates the successor of a valid 'numberIf CheckForValid(Num) Then        Generate = Num + 13        'if valid GenerateElse        Generate = -1        ' Otherwise return -1   End IfEnd Function
See also  What Are International Payments, And How Do They Work?
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist