home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / jgl_1_1 / jgl_1_1.exe / src / LengthString.java < prev    next >
Encoding:
Java Source  |  1996-09-10  |  620 b   |  26 lines

  1. // Copyright(c) 1996 ObjectSpace, Inc.
  2. // Portions Copyright(c) 1995, 1996 Hewlett-Packard Company.
  3.  
  4. package jgl;
  5.  
  6. /**
  7.  * LengthString is a unary function that returns the length of 
  8.  * its operand as a string.
  9.  * <p>
  10.  * @version 1.1
  11.  * @author ObjectSpace, Inc.
  12.  */
  13.  
  14. public final class LengthString implements UnaryFunction
  15.   {
  16.   /**
  17.    * Return the length of my operand's string as an Integer.
  18.    * @param object The operand
  19.    * @return The length of the operand.toString().
  20.    */
  21.   public Object execute( Object object )
  22.     {
  23.     return new Integer( object.toString().length() );
  24.     }
  25.   }
  26.