Collection

Contains all constructs you need when working with collections.

Example

use Collection;

// get the number of items in a collection
var list = ["a","b","c","d","e"];
Collection.length(list); // outputs "5"

System

Contains 'special' constructs that give system information, output to the console or just don't belong in any other package.

Example

use System;
// Get the PATH environmental variable
System.properties("PATH");

// Get the currently used Xill version
System.version();
// Result: 3.0.0
System.version("3.0.1");
// Throws an error and outputs "Version 3.1.0 is not supported in 3.0.0"

Math

Mathemetical constructs are grouped in this package.

Example

use Math;
use System;
System.print(Math.round(3.14)); // prints 3

String

Contains all constructs you need when working with strings.

Example

use System;
use String;

var html="<p>This html has <b>old-fashioned</b> tag usage.<br>Also it is not XML-compatible.</p>";
var xhtml = String.replace(html,"<br>","<br />", false);
xhtml = String.replace(xhtml,"<b>","<strong>",false);
System.print(xhtml);

File

Communication with the file system is done using constructs from the File package, except if the functionality is more related to another package. So, even though saving an Excel workbook is very file system related, that functionality is found in the Excel package.

Example

use System;
use File; // check whether some folder exists
var defaultUserFound = File.exists("C:/Users/default");
System.print(defaultUserFound); // probably outputs 'true' if you are on Windows

var permissions = File.getPermissions("C:/");
System.print(permissions.groups["BUILTIN\\Users"].write);
// prints 'true' if ordinary users have write acces to C:/

Date

Contains all specific date- and time functionality. Some functions in this package may function differently depending on the locale set in your operating system. For example Date.format() will localize the names of days and months according to your system locale, and likewise Date.parse() will only be able to parse names of days and months that match your system settings. To force Xill to a specific locale, the flag "-Duser.language=en-US" can be passed to the application.

Example

use System;
use Date;
var now = Date.now();
System.wait(500);
var datediff = Date.diff(now,Date.now());
System.print(datediff.totalMillis); // Outputs a number close to the set wait time of 500ms