Ruby – the easiest way to remove the first character from a string

rubystring

Example:

[12,23,987,43

What is the fastest, most efficient way to remove the "[",
using maybe a chop() but for the first character?

Best Answer

Similar to Pablo's answer above, but a shade cleaner :

str[1..-1]

Will return the array from 1 to the last character.

'Hello World'[1..-1]
 => "ello World"