如何在Delphi中获取动态数组的长度? [英] How to get length of a dynamic array in Delphi?

查看:347
本文介绍了如何在Delphi中获取动态数组的长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Delphi中是否有确定动态数组长度的函数?

Is there a function to determine length of a dynamic array in Delphi ?

推荐答案

使用 Length 函数来获取数组的长度:

Use Length function to get the length of your array:

var
  ArrayLength: Integer;
begin
  ArrayLength := Length(ArrayOfSomething);
  ...
end;

从此功能的参考文献(由我强调):

From the reference for this function (emphasized by me):


在Delphi代码中, Length返回字符串中实际使用的字符
的数量或数组中元素的数量

In Delphi code, Length returns the number of characters actually used in the string or the number of elements in the array.

这篇关于如何在Delphi中获取动态数组的长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆