【问题标题】:Return an Array Length in Livecode在 Livecode 中返回数组长度
【发布时间】:2015-01-02 01:51:57
【问题描述】:

我有一个包含四个字符串值“Hello”、“All”、“of”和“you”的数组。我需要显示数组的总长度为 4 并将其显示为标签文本。该怎么做?

【问题讨论】:

    标签: arrays livecode variable-length-array


    【解决方案1】:

    你可以试试:

    "item 2 of the extents of YourArrayName" 将显示最后一个元素编号,在某些情况下是数组的长度。 item 1 将为您提供第一个元素编号。元素有时也称为索引。 MyArray[1],MyArray[2] 等

    将 MyArrayName 的元素个数放入“数组长度”字段

    将 MyArrayName 的键的行数放入字段 ""Array Length"

    【讨论】:

    • 要检查数组的长度,您应该使用the number of elements of MyArrayName 形式。此外,您无法检查 the number of keys 数组。你需要检查the number of lines of the keys
    • 是的,没错。将编辑答案!感谢指正
    猜你喜欢
    • 1970-01-01
    • 2023-03-06
    • 2013-12-10
    • 2014-02-18
    • 2015-07-17
    • 1970-01-01
    • 1970-01-01
    • 2014-07-07
    • 1970-01-01
    相关资源
    最近更新 更多