Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有与 Python 的方法等效的 Ruby 方法来获取以字符串结尾结尾的子字符串,例如str[3:]?不方便输入字符串的长度。
str[3:]
传递最后一个元素 = -1 的范围
str[3..-1]