[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby equivalent of Integer.toHexstring(int) method in java

anil kandimalla

9/10/2008 12:26:00 PM

Hi all
Hi guys i am new to ruby,i am searching for a ruby method which
gives the same output as given by Integer.toHexstring(int),but unable
to find any methods.

Is there is a ruby method or can i call this java method from a ruby
file and passing the parameter and get the output from this java
method.

Any help is greatly appreciated.

Thanks
2 Answers

Robert Klemme

9/10/2008 12:28:00 PM

0

2008/9/10 anil kandimalla <anilkandimalla@gmail.com>:
> Hi guys i am new to ruby,i am searching for a ruby method which
> gives the same output as given by Integer.toHexstring(int),but unable
> to find any methods.
>
> Is there is a ruby method or can i call this java method from a ruby
> file and passing the parameter and get the output from this java
> method.

irb(main):001:0> 123.to_s 16
=> "7b"
irb(main):003:0> "%x" % 123
=> "7b"
irb(main):004:0> sprintf "%x", 123
=> "7b"
irb(main):005:0> printf "%x\n", 123
7b
=> nil

Cheers

robert


--
use.inject do |as, often| as.you_can - without end

Lex Williams

9/10/2008 12:57:00 PM

0

anil kandimalla wrote:
> Hi all
> Hi guys i am new to ruby,i am searching for a ruby method which
> gives the same output as given by Integer.toHexstring(int),but unable
> to find any methods.
>
> Is there is a ruby method or can i call this java method from a ruby
> file and passing the parameter and get the output from this java
> method.
>
> Any help is greatly appreciated.
>
> Thanks

if you don't like the ruby way , you could call that method directly
from jruby :)
--
Posted via http://www.ruby-....