AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
toString (Object obj [, int depth]) reserved
 
Returns a string representation of obj that can give you a quick look at a complicated object, like a dictionary, or help when you want to combine objects into a string using addition. The optional depth argument, which is 1 by default, provides some control of the dump. Increasing depth can increase the detail, because toString generates a full dump of any object (e.g., an array or dictionary) that is encountered at a level less than depth. Incidentally, the %O format specification that can be used with built-ins like printf and strfmt, works just like toString but lets you skip the call.
 
 Example:   The program,
import yoix.stdio.*;

puts(toString(yoix));
prints something like
Dictionary[21:0]
   >awt=Dictionary[68:0]
    ctype=Dictionary[15:0]
    data=Dictionary[7:0]
    error=Dictionary[44:0]
    graph=Dictionary[24:0]
    graphics=Dictionary[19:0]
    image=Dictionary[15:0]
    io=Dictionary[49:0]
    math=Dictionary[50:0]
    module=Dictionary[0:0]
    net=Dictionary[7:0]
    parser=Dictionary[15:0]
    re=Dictionary[11:0]
    sound=Dictionary[0:0]
    stdio=Dictionary[29:0]
    string=Dictionary[45:0]
    system=Dictionary[51:0]
    thread=Dictionary[13:0]
    type=Dictionary[33:0]
    util=Dictionary[26:0]
    windows=Dictionary[4:0]
on standard output, but change the program slightly,
import yoix.stdio.*;

puts(toString(yoix, 2));
and you get a dump that is too big to include here.
 
 Return:   String
 
 See Also:   fprintf, printf, sprintf, strfmt

 

Yoix is a registered trademark of AT&T Inc.