Stay organized with collections
Save and categorize content based on your preferences.
arrays.size
arrays.size( array )
Description
Returns the size of the array. Returns 0 for an empty array.
Param data types
ARRAY_STRINGS|ARRAY_INTS|ARRAY_FLOATS
Return type
INT
Code samples
Example 1
This example uses a string array that contains two elements.
arrays.size(["test1", "test2"]) = 2
Example 2
This example uses an int array that contains 3 elements.
arrays.size([1, 2, 3]) = 3
Example 3
This example uses a float array thats contains 1 elements
arrays.size([1.200000]) = 1
Example 4
This example uses an empty array.
arrays.size([]) = 0
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-14 UTC."],[[["\u003cp\u003eThe \u003ccode\u003earrays.size\u003c/code\u003e function calculates and returns the number of elements within an array.\u003c/p\u003e\n"],["\u003cp\u003eThis function supports arrays containing strings, integers, or floats.\u003c/p\u003e\n"],["\u003cp\u003eAn empty array passed to \u003ccode\u003earrays.size\u003c/code\u003e will result in a return value of 0.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003earrays.size\u003c/code\u003e can be found within the Rules and Search sections of the documentation.\u003c/p\u003e\n"]]],[],null,["### arrays.size\n\nSupported in: \n[Rules](/chronicle/docs/detection/default-rules) [Search](/chronicle/docs/investigation/udm-search) \n\n arrays.size( array )\n\n#### Description\n\nReturns the size of the array. Returns 0 for an empty array.\n\n#### Param data types\n\n`ARRAY_STRINGS|ARRAY_INTS|ARRAY_FLOATS`\n\n#### Return type\n\n`INT`\n\n#### Code samples\n\n##### Example 1\n\nThis example uses a string array that contains two elements. \n\n arrays.size([\"test1\", \"test2\"]) = 2\n\n##### Example 2\n\nThis example uses an int array that contains 3 elements. \n\n arrays.size([1, 2, 3]) = 3\n\n##### Example 3\n\nThis example uses a float array thats contains 1 elements \n\n arrays.size([1.200000]) = 1\n\n##### Example 4\n\nThis example uses an empty array. \n\n arrays.size([]) = 0"]]