01: /*
02: * @(#)format.java 1.2 04/12/06
03: *
04: * Copyright (c) 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package org.pnuts.lib;
10:
11: import pnuts.lang.*;
12:
13: public class format extends PnutsFunction {
14:
15: public format() {
16: super ("format");
17: }
18:
19: public boolean defined(int narg) {
20: return (narg == 1);
21: }
22:
23: protected Object exec(Object args[], Context context) {
24: if (args.length != 1) {
25: undefined(args, context);
26: return null;
27: }
28: return pnuts.lang.Pnuts.format(args[0]);
29: }
30:
31: public String toString() {
32: return "function format(obj)";
33: }
34: }
|