Array

Array.size(@arg0)

$test[0] = 1;
$test[1] = 2;
$test[2] = 3;

// returns 3
$len = Array.size(@test);

Cast

Cast.toNumber($arg0)

// Make String valuable
$test = "11922"
$test = Cast.toNumber($test);

$test++;  // Operations for Number valuable is available

Cast.toDouble($arg0)

// Make String valuable
$TEST = "-0.354";
$TEST = Cast.toDouble($TEST);

Crypt

Crypt.md5($str)

Returing crypt string with md5.

ex.

$MD5 = Crypt.md5("TEST");

File

The File functions handle files and folders under "ALINOUS_HOME". The root of path is "ALINOUS_HOME" folder. Therefore the path "/" means "ALINOUS_HOME" folder.

File.exists($srcAlinousPath?)

Checking if the file exists or not.

if(File.exists("/tmp/Sample.jpg")){
    return;
}

File.getTimestamp($srcAlinousPath?)

Getting the timestamp of file and Folder as the Timestamp formatted string.

// Returns string like "2007-06-12 12:13:32.678"
$TM = File.getTimestamp("/tmp/Sample.jpg");

File.makeDir($srcAlinousPath?)

Making a dir or dirs those the $srcAlinousPath? contains.

File.makeDir("/upload/images/");

File.move($srcAlinousPath?, $destAlinousPath?)

Moving the file. If failed, then returns -1.

File.move($tmpFile, "/upload/images/" + $IN.file);

File.copy($srcAlinousPath?, $destAlinousPath?)

Copying the file. If failed, then returns -1.

File.copy($tmpFile, "/upload/images/" + $IN.file);

File.remove($alinousPath)

deleting the file

// delete the file
$File.delete("/tmp/sample.jpg")

File.getSize($alinousPath)

Returning the size of file.

// get size
$SIZE = File.getSize("/tmp/sample.jpg")

Mail

Mail.send($mailObj)

Also see Email configration

// Create mail object
$mail.from = "dummy@hogehoge.com";
$mail.to = "hoge@hogehoge.com";
$mail.cc = "hoge2@hogehoge.com";
$mail.bcc = "hoge2@hogehoge.com";
$mail.subject = "Test mail";

$mail.body = "Hello.
This is a test mail.
If you get this mail, your mail account is correct.

Thanks";

// Send
Mail.send($mail);

We can send mail to multiple addresses by defining "to", "cc" or "bcc" as array.

$mail.to[0] = "hoge@hogehoge.com";
$mail.to[1] = "hoge@hogehoge.com";
$mail.to[2] = "hoge@hogehoge.com";

String

String.replace($inStr, $pattern, $replaceStr)

$TEST = "<A href=\"test\">";
$TEST = String.replace($TEST, "<", "&lt;");
$TEST = String.replace($TEST, ">", "&gt;");

String.subString($str, $beginIndex, $endIndex)

Returing substringof $str.

ex.

$TEST_STR = "Hello world!!";
$OUT = String.subString($TEST_STR, 0, 5); // returns "Hello"

return 0;

String.split($str, $regex)

Spliting $str with token $regex, and returning array of string.

ex.

$TEST_STR = "Tom,Bob,Nancy"; 

@OUT = String.split($TEST_STR, ",");
for($i = 0; $i < Array.size(@OUT); $i++){
	$OUT[$i] = "Hello " + $OUT[$i];
}

String.toUpperCase?($str)

Returning upper case string.

ex.

$TEST_STR = "hello";
$OUT = String.toUpperCase($TEST_STR);

String.toLowerCase?($str)

Returning lower case string.

ex.

$TEST_STR = "HELLO";
$OUT = String.toLowerCase($TEST_STR);

String.trim($str)

Returning trimed string.

ex.

$TEST_STR = "HELLO  ";
$OUT = String.trim($TEST_STR);

String.startsWith($str, $prefix)

Returns boolean value. If $str starts with $prefix, it returns true, else returns false.

ex.

$TEST_STR = "HELLO  ";

if(String.startsWith($TEST_STR, "HE")){
	$OUT = true;
}

String.endsWith($str, $suffix)

Returns boolean value. If $str ends with $prefix, it returns true, else returns false.

ex.

$TEST_STR = "HELLO";

if(String.endsWith($TEST_STR, "LO")){
	$OUT = true;
}

String.getAt($str, $i)

Returning one charactor at position $i.

ex.

$CH = String.getAt("HELLO", 2);

String.length($str)

Returns length of the string.

ex.

$LEN = String.length("HELLO");

String.match($str, $regExp)

Return if the $str matches regular expression $regExp.

ex.

if(String.match("aaaaab", "a*b")){
	$TEST = "OK";
}

String.isAscii($str)

Return true if the $str doesn't contain a non-Ascii charactor.

if(String.isAscii("Ascii string")){
   // If matched, coming here
   $TEST = "OK";
}

Timestamp

Timestamp.format($timestamp, $format)

Formating the timestamp string into format you like.

ex.

$FMT = Timestamp.format($CUR, "'Today is ' yyyy/MM/dd ");

We can use fowwloing macros in $format string.


yYearYear1996; 96
MMonth in yearMonthJuly; Jul; 07
wWeek in yearNumber27
wWeek in monthNumber2
DDay in yearNumber189
dDay in monthNumber10
FDay of week in monthNumber2
EDay in weekTextTuesday; Tue
aAm/pm markerTextPM
HHour in day (0-23)Number0
kHour in day (1-24)Number24
KHour in am/pm (0-11)Number0
hHour in am/pm (1-12)Number12
mMinute in hourNumber30
sSecond in minuteNumber55
SMillisecondNumber978
zTime zoneGeneral time zonePacific Standard Time; PST; GMT-08:00
ZTime zoneRFC 822 time zone-0800

Timestamp.now()

Getting current time.

ex.

// returns timestamp format string
$CUR = Timestamp.now();

Timestamp.before($timestamp, $whenTimestamp)

Returing if $timestamp is before $whenTimestamp.

ex.

$CUR = Timestamp.now();
$TMP = "2007-06-29 14:27:16";

$BL = Timestamp.before($CUR, $TMP);

if($BL){
	$TEST = 'yes';
}

Timestamp.after($timestamp, $whenTimestamp)

Returing if $timestamp is after $whenTimestamp.

ex.

if(Timestamp.after($CUR, $TMP)){
	$TEST = 'yes';
}

Timestamp.getYear($timestamp)

Getting year of the timestamp string.

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";
$INT_VAL = Timestamp.getYear($TMP);

Timestamp.getMonth($timestamp)

Getting Month of the timestamp string.

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";
$INT_VAL = Timestamp.getMonth($TMP);

Timestamp.getDay($timestamp)

Getting day of month of the timestamp string.

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";
$INT_VAL = Timestamp.getDay($TMP);

Timestamp.getDayOfWeek?($timestamp)

Getting day of week as integer value. Also see convertDayOfWeek?() in this section.

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";
$INT_VAL = Timestamp.getDayOfWeek($TMP);

Timestamp.getHour($timestamp)

Getting hour.

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";
$INT_VAL = Timestamp.getHour($TMP); // returns 2

Timestamp.getOurOfDay?($timestamp)

Getting hour of the day.

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";
$INT_VAL = Timestamp.getHourOfDay($TMP); // returns 14

Timestamp.getMinute($timestamp)

Getting munute.

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";
$INT_VAL = Timestamp.getMinute($TMP);

Timestamp.getSecond($timestamp)

Getting second.

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";
$INT_VAL = Timestamp.getSecond($TMP);

Timestamp.getMilliSecond?($timestamp)

Getting milli second.

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";
$INT_VAL = Timestamp.getMilliSecond($TMP); // returns 0

$TMP = "2007-06-29 14:27:16.123";
$INT_VAL = Timestamp.getMilliSecond($TMP); // returns 123

Timestamp.add($timestamp, $amount, $field)

Adding the value of the field. We can set minus value at $amount. Available values in $field are :-

  • YEAR
  • MONTH
  • DATE
  • HOUR
  • MINUTE
  • SECOND
  • MILLISECOND

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";

$RET_VAL = Timestamp.add($TMP, 1, "DATE");

Timestamp.set($timestamp, $amount, $field)

Setting the value of the field. Available values in $field are :-

  • YEAR
  • MONTH
  • DATE
  • HOUR
  • MINUTE
  • SECOND
  • MILLISECOND

ex.

// Making timestamp format string
$TMP = "2007-06-29 14:27:16";

$RET_VAL = Timestamp.set($TMP, 1, "DATE");

Timestamp.convertDayOfWeek?($num, @dayOgWeeks?)

Converting number of the week into string value.

ex.

$DAYS[0] = "SUNDAY";
$DAYS[1] = "MONDAY";
$DAYS[2] = "TUSEDAT";
$DAYS[3] = "WEDNESDAY";
$DAYS[4] = "THURSDAY";
$DAYS[5] = "FRIDAY";
$DAYS[6] = "SATURDAY";

$CUR = Timestamp.now();
$DAY_NUM = Timestamp.getDayOfWeek($CUR);
$DAY = Timestamp.convertDayOfWeek($DAY_NUM, @DAYS);

Variable

Variable.release($dompath)

Release variable.

$SESSION.AAA = "AAA";

// Release
Variable.release($SESSION.AAA);

$TEST.BBB = "BBB";

// Release
Variable.release($TEST);

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2008-01-14 (Mon) 04:48:06 (969d)