Axaptapedia is now maintained by AgileCadence For more information please click here.

Array Class

From Axaptapedia
Jump to: navigation, search

Array (Foundation class) function the same way as ordinary arrays, the main difference being that table buffers and objects can be used as contents.

The array is created with a type that defines what contents the array contains. It can not use Types::Anytype.

Example[edit]

<xpp> container c; Array a = new Array(Types::string);

a.value(1, "First"); a.value(2, "Second"); a.value(3, "Third"); print a.lastIndex(); print a.toString();

pause; </xpp>

Tips[edit]

When inserting the array is dynamically expanded. If you just want to add an element to the end of the array it is possible to use: <xpp> a.value(a.lastIndex()+1, "element"); </xpp> As with other foundation classes, the array can be passed across tiers by converting it to a container. The pack method converts it to a container: <xpp> c = a.pack(); </xpp> To convert the packed container back to an array, call the static create method of the Array class: <xpp> a = Array:create(c); </xpp>

Methods[edit]

  • definitionString
  • exists
  • lastIndex
  • pack
  • toString
  • typeId


See also[edit]