length

Get the length of a String or Number, or the number of items in an Array.


Syntax


Parameters

  • Mixed subject - The entity to get the length of. This can be any PTPScript data type.
    • String - The length of the String will be returned.
    • Number - The Number will be treated as a String.
    • Boolean - The Boolean will be returned as a Number.
    • Array - The number of items in the Array will be returned.
  • Boolean recurse - The optional recurse parameter only has any effect if subject is an Array.
    • false (default) - Only items in the immediate Array will be counted.
    • true - The Array will be counted recursively, i.e. sub-Arrays will be counted too.


Result

  • Number - The length of subject, or how many items it contains.

Returns the length of subject. If subject is a String, the length of the String will be returned. Numbers will be treated as Strings, and Booleans return their numeric equivalent. If subject is an Array, the number of items it contains will be returned.

ptpscript/functions/length.txt · Last modified: 2007/01/24 10:15
 
 
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki