ruby - Replace array's integer with another integer -


i have array

array=[10000,415455,10000,4529856,25632,10000,45556,58456,25654] 

i want replace 10000 00000

how can please?

if you're looking edit in place need map!

array=[10000,415455,10000,4529856,25632,10000,45556,58456,25654] array.map! {|item| item == 10000 ? 0 : item} 

when display make sure use formatting displays 5 characters leading 0's

i believe ruby

array.each {|item|   puts sprintf "%05d", item } 

Comments