Ruby相当于Python str [3:]

Pau*_* S. 5 ruby python substring

有没有Ruby相当于Python的方法来获取一个以字符串末尾结尾的子字符串,比如str[3:]?不得不放入字符串的长度是不方便的.

Dog*_*ert 10

传递最后一个元素= -1的范围

str[3..-1]
Run Code Online (Sandbox Code Playgroud)