strList = New String( intCount ) creates intCount+1 elements

I have an int32 variable (intCount) that is the number of substrings in a comma-separated string.

I declared strList as String[]. For this example, intCount is 22.

After strList = New String( intCount ), strList shows string[23] {“”, “”, …, “”}

I would expect it to show string[22], with indices 0 - 21.

Does the value intCount represent the number of items or the highest index?

It’s the last index, not the count.

' Declare an array with 7 elements.
Dim students(6) As Integer

It declares a students array with seven elements. The number 6 in the array declaration indicates the last index in the array; it is one less than the number of elements in the array.

Then it would appear there is a bug in UiPath as that is NOT what is does.

I don’t believe it’s a bug since it’s working as Microsoft described.

You said in your first post that your intCount is 22, so strList = New String(intCount) in your case is strList = New String(22). Since 22 is your last index you would have 23 elements (0 to 22).

OK - In my past experiences, the number provided in the init statement (strList = New String( intCount )), intCount would be the number of items (indices 0…intCount-1), not the highest index (indices 0…intCount). This is why I am confused. Thanks.

No problem. I concur that VB is confusing in this regard. In C# int[] array = new int[5]; will give you five elements as expected.