string s = "1234567"; string last6chars = new string(s.reverse().take(6).reverse().toarray());//先反转顺序,从开头截取指定数量的字符,再反转顺序