delphi 生成随机字符串


本文整理自网络,侵删。

  function RandomStr(majuscule:boolean;lowercase:boolean;number:boolean;digit:integer):string;
//大写字母,小写字母,数字,字符串的位数
var
i: Byte;
s: string;
begin
if majuscule then
s := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
else
s := '';

if lowercase then
s := s + 'abcdefghijklmnopqrstuvwxyz';

if number then
s := s + '0123456789';
if s = '' then exit;

Result := '';
for i := 0 to digit-1 do //根据长度来循环
begin
Randomize;//每次都初始化随机种子
Result := Result + s[Random(Length(s)-1)+1];
end;
end;

相关阅读 >>

Delphi remobjects,您值得拥有

Delphi 提取时间成分

Delphi xe5 android 黑屏的临时解决办法

Delphi串口api函数

Delphi stringgrid 实例4 本例功能: 1、给每个单元格赋值 2、调整当前单元格位置:上下左右;

Delphi 对比时间的函数

Delphi写游戏外挂

Delphi 将整数转换为罗马数字(字符串)2

Delphi windows 编程[15] - 菜单消息: wm_command

Delphi 防止程序重复执行(多种方法)

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...