Extract Numbers from String

Extract all numbers from a string.

Code

General
str.scan(/\d+/).map(&:to_i)

Parameters

The string to extract numbers from

Server

More Ruby Snippets