Substring in X++

A few examples of using the substring method in X++:

substr(str _mainString, int _beginningIndex, _int _length)


static void substrings(Args _args)
{
str hello = "Hello World!";
;

hello = substr(hello, 1, 5);
info(strfmt("%1", hello)); // prints "Hello"

hello = substr(hello, 5, -2);
info(strfmt("%1", hello)); // prints "lo"

substr(hello, 1, 1);
info(strfmt("%1", hello)); // still prints "lo", return value was not assigned back to variable
}