util.printd() | for dates |
util.printf() | for numbers |
util.printx() | for text |
Here are some samples of using these methods;
Code | Output | Description |
---|---|---|
var v = util.printx(">?<*","ADOBE") console.println(v) |
Adobe | This changes the first character (represented by the ?) to uppercase (represented by the >) and all trailing characters (represented by the *) to lowercase (represented by the <) |
var v = util.printx("9999999999","My phone number is (02) 1111 2222") console.println(v) |
0211112222 | Copies the first 10 digits, skipping any others characters |
var v = util.printd("mmmm",new Date())console.println(v) |
March | Prints the current month in full. |
var v = util.printd("dddd",new Date())console.println(v) | Thursday | Prints the current day of the week in full |
var v = util.printd("date.short(){}",new Date(),true); console.println(v) |
27/03/14 | Prints the date in the same format as the "datetime.short{}" display pattern. The actual output will vary depending on the current locale. |
var v = util.printd("date(fr){MMMM}",new Date(),true)console.println(v) | mars | Prints the current month in French |
var v = util.printf("%,105d", 2)console.println(v) | 00002 | Prints the number 2 in a width of 5 characters with "0" characters padding |