delphi RandString 随机字符串


本文整理自网络,侵删。

 
function RandString(s: string; Min, Max: Integer): string;
var
 count, i, r : Integer;
begin
 Result := '';
 if ((Max - Min) > 0) then
 begin
  count := Random(Max - Min + 1) + Min;
  for i := 0 to count - 1 do
  begin
   r := Random(Length(s)) + 1;
   Result := Result + s[r];
  end;
 end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(RandString('ABCDEFGHIJKLMN',9,10));
end;

相关阅读 >>

Delphi 拖动form上的图片,form一起动

Delphi inc函数和dec函数的用法

Delphi 如何从dll中检索导出函数的列表

Delphi unigui form控件跳转

Delphi 时间与相关类型(2) - tdate、ttime、ttimestamp

Delphi 10.3 调试程序时出错:unable to create process:请求的操作需要提升

Delphi创建桌面快捷方式及锁定任务栏等功能

Delphi获取jpg图片的高度、宽度

Delphi 10 seattle plus 新特性――system.json.builders

Delphi 隐藏进程代码

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



打赏

取消

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

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

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

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

评论

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