컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
arrays.index_to_int
arrays.index_to_int(array_of_inputs, index)
설명
배열에서 지정된 색인의 값을 정수로 반환합니다.
색인은 배열에서 요소의 위치를 나타내는 정수 값입니다.
기본적으로 배열의 첫 번째 요소는 색인이 0이고 마지막 요소는 색인이 n-1입니다. 여기서 n은 배열의 크기입니다.
음수 색인 생성을 사용하면 배열 끝을 기준으로 배열 요소에 액세스할 수 있습니다. 예를 들어 색인 -1은 배열의 마지막 요소를 참조하고 색인 -2는 배열의 마지막에서 두 번째 요소를 참조합니다.
매개변수 데이터 유형
ARRAY_STRINGS|ARRAY_INTS|ARRAY_FLOATS
, INT
반환 유형
INT
코드 샘플
예 1
이 함수 호출은 색인의 값이 숫자가 아닌 문자열인 경우에 0을 반환합니다.
arrays.index_to_int(["str0", "str1", "str2"], 1) = 0
예 2
이 함수는 색인 -1의 요소를 반환합니다.
arrays.index_to_int(["44", "11", "22", "33"], 0-1) = 33
예시 3
범위를 벗어난 요소에는 0을 반환합니다.
arrays.index_to_int(["44", "11", "22", "33"], 5) = 0
예 4
이 함수는 색인 1의 부동 소수점 배열에서 요소를 가져옵니다.
arrays.index_to_int([1.100000, 1.200000, 1.300000], 1) = 1
예시 5
이 함수는 색인 0의 정수 배열에서 요소를 가져옵니다.
arrays.index_to_int([1, 2, 3], 0) = 1
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-29(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-29(UTC)"],[[["\u003cp\u003e\u003ccode\u003earrays.index_to_int\u003c/code\u003e retrieves an element from an array at a specified index and returns it as an integer.\u003c/p\u003e\n"],["\u003cp\u003eThe function supports positive and negative indexing, with negative indices counting from the end of the array.\u003c/p\u003e\n"],["\u003cp\u003eIf the element at the specified index is a non-numeric string or the index is out of bounds, the function returns 0.\u003c/p\u003e\n"],["\u003cp\u003eThe function takes two parameters, the first being the array (that can consist of string, integers or float values), and the second the index (an integer).\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003earrays.index_to_int\u003c/code\u003e is supported in both Rules and Search.\u003c/p\u003e\n"]]],[],null,["### arrays.index_to_int\n\nSupported in: \n[Rules](/chronicle/docs/detection/default-rules) [Search](/chronicle/docs/investigation/udm-search) \n\n arrays.index_to_int(array_of_inputs, index)\n\n#### Description\n\nReturns the value at a given index in an array as an integer.\n\nThe index is an integer value which represents the position of an element in the array.\nBy default, the first element of an array has an index of 0, and the last element has an index of n-1, where n is the size of the array.\nNegative indexing allows accessing array elements relative to the end of the array. For example, an index of -1 refers to the last element in the array and an index of -2 refers to the second to last element in the array.\n\n#### Param data types\n\n`ARRAY_STRINGS|ARRAY_INTS|ARRAY_FLOATS`, `INT`\n\n#### Return type\n\n`INT`\n\n#### Code samples\n\n##### Example 1\n\nThis function call returns 0 when the value at the index is a non-numeric string. \n\n arrays.index_to_int([\"str0\", \"str1\", \"str2\"], 1) = 0\n\n##### Example 2\n\nThis function returns the element at index -1. \n\n arrays.index_to_int([\"44\", \"11\", \"22\", \"33\"], 0-1) = 33\n\n##### Example 3\n\nReturns 0 for the out-of-bounds element. \n\n arrays.index_to_int([\"44\", \"11\", \"22\", \"33\"], 5) = 0\n\n##### Example 4\n\nThis function fetches the element from the float array at index 1. \n\n arrays.index_to_int([1.100000, 1.200000, 1.300000], 1) = 1\n\n##### Example 5\n\nThis function fetches the element from the int array at index 0. \n\n arrays.index_to_int([1, 2, 3], 0) = 1"]]