我有一个正则表达式的结果,它将七个捕获组返回到一个数组中.
我以为我会使用解构,而不是使用数组元素的下标来构造我的对象,问题是我似乎只能有五个组件.
A minimal example:
// val (a, b, c, d, e) = listOf(1, 2, 3, 4, 5)
val (a, b, c, d, e, f, g) = listOf(1, 2, 3, 4, 5, 6, 7)
Compiler output:
> Error:(70, 41) Kotlin: Destructuring declaration initializer of type
> List<Int> must have a 'component6()' function
> Error:(70, 41) Kotlin: Destructuring declaration initializer of type
> List<Int> must have a 'component7()' function
有没有办法拥有五个以上的组件,或者这是最大值?