delphi随机字符(密码生成)函数


本文整理自网络,侵删。

 
function GetRandStr(len : Integer; lowercase : Boolean = True; num : Boolean = True; uppercase : Boolean = False) : string;const  upperStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';  lowerStr = 'abcdefghijklmnopqrstuvwxyz';  numStr = '0123456789';var  sourceStr : string;  i : Integer;begin  sourceStr := '';  Result := '';  if uppercase = True then    sourceStr := sourceStr + upperStr;  if lowercase = True then    sourceStr := sourceStr + lowerStr;  if num = True then    sourceStr := sourceStr + numStr;  if (sourceStr = '') or (len<1) then    exit;  Randomize;  for i:=1 to len do  begin    Result := Result + sourceStr[Random(Length(sourceStr)-1)+1];  end;end;

相关阅读 >>

Delphi 调用打印软件代码

Delphi 数组复制利用copymemory 最为完美

Delphi cardpanel1 简单的切换

Delphi中用ado连接加密access数据库

Delphi 异或加解密

Delphi mscomm 实时串口通讯

Delphi tpath

Delphi listboxadditems() 不重复添加edit1

Delphi获取系统当前进程名和进程id

Delphi pc喇叭发声

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



打赏

取消

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

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

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

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

评论

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