mdsk.net
当前位置:首页 >> 生成4位验证码,从大写字母,小写字母,数字中生成... >>

生成4位验证码,从大写字母,小写字母,数字中生成...

Private Sub Command1_Click() Dim strIn As String, I As Integer, T As String, strOut As String strIn = InputBox("请输入字符串:") For I = 1 To Len(strIn) T = Mid(strIn, I, 1) If T >= "A" And T

是每一个验证码都要包含数字和字母还是可以有纯数字或纯字母 可以随机生成一个数字通过一个表得到相应的字符 然后再输出 如果自己不想写代码的话3到5元我可代劳

如果是单独的纯数字或字母,这种方式还可以,但是要混合的话,只有先把数字和字母放在数组里,随机取4个组成一个字符串

代码如下:

public class GenerateRandomLetterAndNum { public static void main(String[] args) { Set store = getletterandnum(6); printSet(store); } public static Set getletterandnum(int length) { Set set =new HashSet(); for (int i = 0; i < l...

生成随机可以用Random类,不能重复可以考虑放在HashSet中,因为HashSet的值是不能重复的,看代码如下: public class GenerateRandomLetterAndNum {public static void main(String[] args) { Set store = getletterandnum(6); printSet(store);...

package p1;public class Guy{private static String randomStr ( int len ){if (len == 0){return "";}int a = (int) ( Math.random () * 3 );if (a == 0){return ( (int) ( Math.random () * 10 ) ) + randomStr (len - 1);}else if (a == 1){...

public class TestRange {private final static char[] lower={'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'};private final static char[] upper={'A','B','C','D','E','F','G',...

VBA代码如下,按alt+F11,在sheet1中双击,粘贴。工具 宏 运行宏。执行aaa即可。Sub aaa() For i = 1 To 5000 bb = "" aa = "" For j = 1 To 8 a = VBA.Int(Rnd() * 3 + 1) Select Case a Case Is = 1 bb = Chr(64 + Int(Rnd * 26) + 1) Case Is...

using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace RandomStringDemo{class Program{static void Main(string[] args){string chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrst...

网站首页 | 网站地图
All rights reserved Powered by www.mdsk.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com