You are viewing a single comment's thread. Return to all comments →
def serial_average(key = "001-12.43-56.78") serial = key[0,3] number1 = key[4, 5] number2 = key[10, 15] avg = (number1.to_f + number2.to_f) / 2 avg = avg.round(2) key[4,11] = avg.to_s return key end
Seems like cookies are disabled on this browser, please enable them to open this website
Ruby - Strings - Indexing
You are viewing a single comment's thread. Return to all comments →