Generate a random string of the specified length

Source: Internet
Author: User
Tags character set lowercase
' detects the length of the generated string
Response.Write (Len (ixuer_rnd_str 100,1,1,1,1,1) & "<br>")
' Output to the browser in HTML encoding to avoid the normal display of certain special characters
Response.Write (Server.HTMLEncode (Ixuer_rnd_str (100,1,1,1,1,1))
' Actual application, you can call IXUER_RND_STR (LENGTH,S1,S2,S3,S4,LN) directly
Function Ixuer_rnd_str (LENGTH,S1,S2,S3,S4,LN)
'=========================================================
' Function: Rnd_str
' Function: Generate random string of specified length Ixuer Studio challenge Random string
' Parameters: Length, uppercase, lowercase letters, numbers, special characters, custom characters
' Return: string
' Time: 2004-08-28
' Author: guidy
' Copyright: Ixuer Studio
'=========================================================
' Copyright (C) 2004-2006 114XP. CN all Rights Reserved.
' Official website: http://www.114xp.cn
' Technology Forum: http://bbs.114xp.cn
' Email: guidy@qq.com,guidy@psysch.com
'=========================================================
' Defaults to 15 combination schemes, arbitrary length, and no spaces are allowed in string
' If you specify a custom character set, you can scale to up to 26 combinations of options
' 1) Capital Letter 2 Small Letter 3) Digit 4 special character 5) uppercase, lowercase 6) capital letters, numbers
' 7 uppercase letters, special characters 8) uppercase letters, lowercase letters, number 9, uppercase, lowercase, special characters
' 10 uppercase letters, numbers, special characters 11) caps, lowercase letters, numbers, special characters
' 12 lowercase letters, number 13 lowercase letters, special characters 14 lowercase letters, numbers, special characters 15) digits, special characters
Dim seed,seedary
Dim seed_str,seed_str1,seed_str2,seed_str3,seed_str4,seed_strn
Dim TempStr
Dim i,m

SEED_STR1 = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
SEED_STR2 = "A b c D e F g h i j k l m n o p q R S t u v w x y z"
SEED_STR3 = "0 1 2 3 4 5 6 7 8 9"
SEED_STR4 = "!" "# $% & ' () * +,-. / : ; < = >? @ [ ] ^ _ ` { | } ~"
' Custom character set, note to add a space between each custom character!
SEED_STRN = ""

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.