NUM-ENTRIES ( list , character )A character expression containing a list of character strings separated with a character delimiter. The list can be a variable of type CHARACTER or LONGCHAR. NUM-ENTRIES returns the number of elements in the list. Specifically, NUM-ENTRIES returns the number of delimiters plus 1, and it returns 0 if list equals the empty string ("").In the following example, PROPATH is a comma-separated list of unknown length:
DEFINE VARIABLE ix AS INTEGER NO-UNDO.REPEAT ix = 1 TO NUM-ENTRIES(PROPATH):DISPLAY ENTRY(ix, PROPATH) FORMAT "x(64)".END.This procedure uses NUM-ENTRIES to loop through the PROPATH (a comma-separated list of directory paths) and print the directories, one per line.
DEFINE VARIABLE sentence AS CHARACTER NO-UNDO INITIAL"This sentence would be seven words long if it were six words shorter".DISPLAY NUM-ENTRIES(sentence," ").The NUM-ENTRIES function is multi-byte enabled. The specified list can contain entries that have multi-byte characters and the character delimiter can be a multi-byte character.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |