Select numbers by their first n digits

I have an array of numbers: array = [234, 928234, 234932] I need to count how many of the elements in array have the first three digits as 234; i.e., the result should count in array[0] and array[2]. Is there a way to use .count? If I use array.c...
more »

| ruby   2017-05-21 22:05 (3) Answers