Discuz! BBS

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 562|回复: 0

delphi 连接两个Idbytes为一个IdBytes

[复制链接]

254

主题

363

帖子

2431

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2431
发表于 2024-12-6 23:40:17 | 显示全部楼层 |阅读模式
<草稿>
  1. uses
  2.   IdGlobal;

  3. var
  4.   Bytes1, Bytes2, CombinedBytes: TIdBytes;
  5.   i: Integer;
  6. begin
  7.   // 假设Bytes1和Bytes2是已经初始化并填充数据的TIdBytes对象
  8.   // 这里只是为了示例,所以我们使用简单的赋值来模拟数据
  9.   Bytes1 := Bytes2('Hello');
  10.   Bytes2 := Bytes2('World');

  11.   // 计算CombinedBytes需要的最终大小
  12.   SetLength(CombinedBytes, Length(Bytes1) + Length(Bytes2));

  13.   // 将Bytes1的内容复制到CombinedBytes
  14.   for i := 0 to Length(Bytes1) - 1 do
  15.   begin
  16.     CombinedBytes[i] := Bytes1[i];
  17.   end;

  18.   // 将Bytes2的内容复制到CombinedBytes的末尾
  19.   for i := 0 to Length(Bytes2) - 1 do
  20.   begin
  21.     CombinedBytes[Length(Bytes1) + i] := Bytes2[i];
  22.   end;

  23.   // CombinedBytes现在包含了Bytes1和Bytes2的内容
  24. end;
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|DiscuzX

GMT+8, 2025-4-16 04:17 , Processed in 0.017434 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表