The sizeof() function returns a number depending on the value passed to the function. The sizeof() function converts any values (except for a list or a table) to a string, and returns the number of characters in the string. For lists and tables, the sizeof() function returns the number of defined members.
The syntax is one of the following:
-
sizeof(<value>)
-
sizeOf(<value>)
The following script matches a line of text in a file. The length of each line is measured and printed.
ASL Script (sizeOf_do.asl): START { x:rep(word) eol } do { y = sizeof(x); print("Length ".y); } DEFAULT { ..eol } do { print("Failed match"); } Input (sizeOf_do.txt): This has a size of 21 size of 9 Output: $ sm_adapter --file=sizeof_do.txt sizeof_do.asl Length 21 Length 9 $