RAD function: lng

A RAD function that returns the number of elements in an array or structure and the number of characters in a string. Remember to denull arrays to get the correct number of elements, but be careful when denulling arrays of structures.

Function

lng

Format

lng($variable)

Where $variable is the array, structure, or string.

Factors

  • The $variable must be an array, structure or a character string.
  • Arrays return the number of elements, NULL or otherwise.
  • Strings return the number of characters.
  • Structures return the number of fields.

Examples

lng("1234567890") returns 10.

lng({1,2,3}) returns 3.

lng({1,2,3,,,,}) returns 7.

lng(denull({1,2,3,,,,})) returns 3.