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 tokyo 版本 twebbrowser 的一个问题(bug?)

Delphi将图片缩放成指定大小

Delphi ado 动态建立.mdb数据库,表

Delphi判断某一个点是否在一个区域内

Delphi 提高unigui开发效率的两个方法

Delphi 软关闭显示器的代码

Delphi 根据磁盘盘符获取简单的硬盘编号

Delphi xe listview导出excel

Delphi api读写ini文件

datasnap服务器如何得到客户端的ip和端口

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



打赏

取消

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

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

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

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

评论

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