to_s(...)
public
Returns a string containing the representation of fix radix
base (between 2 and 36).
12345.to_s
12345.to_s(2)
12345.to_s(8)
12345.to_s(10)
12345.to_s(16)
12345.to_s(36)
Show source
/*
* call-seq:
* fix.to_s( base=10 ) -> aString
*
* Returns a string containing the representation of <i>fix</i> radix
* <i>base</i> (between 2 and 36).
*
* 12345.to_s #=> "12345"
* 12345.to_s(2) #=> "11000000111001"
* 12345.to_s(8) #=> "30071"
* 12345.to_s(10) #=> "12345"
* 12345.to_s(16) #=> "3039"
* 12345.to_s(36) #=> "9ix"
*
*/
static VALUE
fix_to_s(argc, argv, x)
int argc;
VALUE *argv;
VALUE x;
{
VALUE b;
int base;
rb_scan_args(argc, argv, "01", &b);
if (argc == 0) base = 10;
else base = NUM2INT(b);
return rb_fix2str(x, base);
}