I come from a php background and in php, there is an array_size() function which tells you how many elements in the array are used.
array_size()
Is there a similar
There is a difference between length of String and array to clarify:
String
array
int a[] = {1, 2, 3, 4}; String s = "1234"; a.length //gives the length of the array s.length() //gives the length of the string