Main Index : Reference :

sizeof()


Description

Gives the number of elements in a string, byte array or array.

Definition

[int] sizeof([string,bytes,array] object)

Parameters

object is a string, byte array or array.

Return Value

sizeof() returns the size of object, that is how many elements there are in it. If object is not a string, byte array or array the return value is nil.

Example

// Outputs "sizeof(str) = 12
//          sizeof(mem) = 7
//          sizeof(arr) = 20"

var str = "Hello World!";
var mem = new(bytes,7);
var arr = new(array,20);

println("sizeof(str) = ",sizeof(str));
println("sizeof(mem) = ",sizeof(mem));
println("sizeof(arr) = ",sizeof(arr));

See Also

typeof(), [string], [bytes], [array]