如何从位置 N 到 Ruby 中的最后一个字符获取子字符串? [英] How can I get a substring from position N to the last char in Ruby?
本文介绍了如何从位置 N 到 Ruby 中的最后一个字符获取子字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从字符串中从位置 N 到字符串末尾获取一个子字符串.
I'd like to get a substring from a string from position N to the end of the string.
在 Ruby 中有什么方法可以做到这一点?
What's the way to do it in Ruby?
推荐答案
将字符串切片如下:
string[N..-1]
这篇关于如何从位置 N 到 Ruby 中的最后一个字符获取子字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文