Zangief Ief wrote: >If my number is 1111, I would like to had 0000. >If my number is 1001, I would like to had 0110. >If my number is 0011, I would like to had 1100. > Thanks :) sprintf("%04d", 1111- 1111) -> 0000 sprintf("%04d", 1111- 1011) -> 0100 sprintf("%04d", 1111- 1001) -> 0110 sprintf("%04d", 1111- 0011) -> 1102 (oops - it treats the second value as octal) sprintf("%04d", 1111- "0011".to_i) -> 1100 Todd -- Posted via http://www.ruby-forum.com/.