obj_keys

obj_keys returns all keys or a range of keys for the given object.

keys = obj_keys(obj)
keys = obj_keys(obj, start)
keys = obj_keys(obj, start, end)

Return Value

keys is an array of integer numbers or strings.

Parameters

obj

obj is the object created with obj_create.

start

start is the first key.

end

end is the predecessor of the last key. start and end must be of the same type, both strings or both numbers.

Comment

obj.keys() returns the string keys.

obj.keys("a", "d") returns all string keys starting with “a”, “b” or “c”. The keys are returned in the alphabetical order.

obj.keys(1) returns all number keys greater or equal to 1.

obj.keys(-DBL_MAX, 0) returns all number keys with negative indices.

obj.keys(1, 10) returns all number keys in the range 1 to < 10.

obj.keys(-DBL_MAX, DBL_MAX) returns all number keys (DBL_MAX is the number 1.7976931348623158e+308.)

Example

obj = obj_create()
for (i in 1:10000) {
    idx = rand(1,1) *100000;
    obj[idx] = i;
}
print obj.keys(1,1000)

id-1690081