Hi!
You passed to the function allow_empty
as true. This means that the PoolStringArray
will have one element with the emtpy character ("" is represented by 0x00 in a string), as you are allowing for that. if you use var strarr = nstr.split(" ",false,0)
you will notice it will return an empty array.
For checking that is different that an array has an empty character, and an empty array, you can do this:
var arr = PoolStringArray([])
var arr2 = PoolStringArray([""])
print(arr.size()) #prints 0
print(arr2.size()) #prints 1
print(arr.empty()) #prints true
print(arr2.empty()) #prints false
In summpary, with allow_true
you are allowing empty string to be set as component of the resulting array, or at least thats what i always understood, since it seems not to be explained in documentation.