There are three parameters container conDel(container container, int start, int number):
- container container
- the container that the user wishes to have the data deleted from
- int start
- the spot in the container to start deleting values
- If this number is 0, it will not delete anything
- The number given will actually be deleted (e.g. 2 will actually include element 2 in the deletion)
- int number
- the number of elements to delete in the container
- If this number is larger than the container, it will delete everything from the start value on
static void daxTestDelContainer(Args _args) { container test = ['a','b','c','d','e','f','g','h','i']; container testManip = test; int i;
info ("BEGIN TEST - the container data in full"); // Cycle (iterate) through the container for (i=1; i <= conlen(testManip); i++) { info(strFmt("%1 - %2", i, conpeek(testManip, i))); }
info ("TEST conDel(testManip, 0, 3) - Remove 3 at spot 0"); testManip = conDel(testManip, 0, 3); // Cycle (iterate) through the container for (i=1; i <= conlen(testManip); i++) { info(strFmt("%1 - %2", i, conpeek(testManip, i))); }
info ("TEST conDel(testManip, 1, 3) - Remove 3 at spot 1"); testManip = conDel(testManip, 1, 3); // Cycle (iterate) through the container for (i=1; i <= conlen(testManip); i++) { info(strFmt("%1 - %2", i, conpeek(testManip, i))); }
// Reset the container testManip = test;
info ("TEST conDel(testManip, 2, 3) - Remove 3 at spot 2"); testManip = conDel(testManip, 2, 3); // Cycle (iterate) through the container for (i=1; i <= conlen(testManip); i++) { info(strFmt("%1 - %2", i, conpeek(testManip, i))); }
// Reset the container testManip = test;
info ("TEST conDel(testManip, 3, 5) - Remove 5 at spot 3"); testManip = conDel(testManip, 3, 5); // Cycle (iterate) through the container for (i=1; i <= conlen(testManip); i++) { info(strFmt("%1 - %2", i, conpeek(testManip, i))); }
// Reset the container testManip = test;
info ("TEST conDel(testManip, 3, 50) - Remove 50 (more than container has) at spot 2"); testManip = conDel(testManip, 3, 50); // Cycle (iterate) through the container for (i=1; i <= conlen(testManip); i++) { info(strFmt("%1 - %2", i, conpeek(testManip, i))); } }
Figure 1 - Infolog from the above code
No comments:
Post a Comment