NUM-ENTRIES function
- Last Updated: July 20, 2021
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Returns the number of elements in a list of character strings as an INTEGER value.
Syntax
|
- list
- 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 ("").
- character
- A delimiter you define for the list. The default is a comma (,). This allows functions to operate on non-comma-separated lists. If you use an alphabetic character, this delimiter is case sensitive.
Examples
This procedure uses NUM-ENTRIES and ENTRY to loop through a list of regions and display them, one per line. Since there are obviously five regions, the REPEAT statement, REPEAT ix = 1 TO 5, works fine here.
r-n-ent1.p
|
In the following example, PROPATH is
a comma-separated list of unknown length:
r-n-ent2.p
|
This procedure uses NUM-ENTRIES to loop through
the PROPATH (a comma-separated list of directory
paths) and print the directories, one per line.
This example uses a list that does not use commas as a delimiter. This procedure returns a value of 13:
r-n-ent3.p
|
Note
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.