In Scala, how to get a slice of a list from nth element to the end of the list without knowing the length?

前端 未结 4 750
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-02 05:34

I\'m looking for an elegant way to get a slice of a list from element n onwards without having to specify the length of the list. Lets say we have a multiline string which I spl

4条回答
  •  北海茫月
    2021-02-02 06:24

    The right answer is takeRight(n):

    "communism is sharing => resource saver".takeRight(3)
                                                  //> res0: String = ver
    

提交回复
热议问题