skip to main content

Frequently Asked Questions

View Suggest a FAQ  

The ad will go away if you log in.

Q:   How do I clear the content of an Array?

A: There are three possibilities (taken from KB 224)

1. To delete the entire contents of an array using one TSL statement, the delete statement can be used.

delete array[]; #for single and multi. dim. arrays

2. Assign the array field an empty value ("").

public ary[];
ary[0] = "one";
ary[1] = "two";
ary[2] = "three";

for (i in ary)

for (i in ary)
ary[i] = "";

print("Array was cleared");

for (i in ary)

3. Use the custom function array_empty.

This function is not part of WinRunner. It is not guaranteed to work and is not supported by Mercury Technical Support. You are responsible for any and all modifications that may be required.

public function array_empty(out array[])

public numbers[] = {1,2,3,4,5};
rc = array_empty(numbers); # The array is now empty.

How helpful was this FAQ?

RSSComments - Make a comment
The comments are owned by the poster. We are not responsible for its content.