Revision: 1660
Updated Code
at November 3, 2006 09:33 by gusto
Updated Code
def non_empty_string_count(array) array.inject(0) {|count,a| count += (a && a.length > 0 ? 1 : 0)} end
Revision: 1659
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 3, 2006 09:31 by gusto
Initial Code
def non_empty_string_count(array) array.inject(0) {|count,a| count += (a && a.length > 0 ? 1 : 0)} end
Initial URL
Initial Description
Need a way to count the number of non empty strings in an array?
Initial Title
Use for Enumerable#inject
Initial Tags
Initial Language
Ruby