无法使用 ++ 连接到数组
Cannot concatenate to array with ++
我似乎无法使用 ++
将值 specChrando
添加到 A
值。
val alphabet1 = "qwertzuiopasdfghjklyxcvbnm"
val lowerCh = alphabet1.toCharArray
val higherCh = alphabet1.toUpperCase.toCharArray
val numb = "1234567890".toCharArray
val specialCh = "#@".toCharArray
val numRando = Random.shuffle(numb.toList).take(2)
val specChrando = Random.shuffle(specialCh.toList).head
val A = lowerCh ++ higherCh ++ numRando ++ specChrando
head
returns 单个元素,而 ++
期望输入是集合。尝试更改为使用 take(1)
而不是 head
我似乎无法使用 ++
将值 specChrando
添加到 A
值。
val alphabet1 = "qwertzuiopasdfghjklyxcvbnm"
val lowerCh = alphabet1.toCharArray
val higherCh = alphabet1.toUpperCase.toCharArray
val numb = "1234567890".toCharArray
val specialCh = "#@".toCharArray
val numRando = Random.shuffle(numb.toList).take(2)
val specChrando = Random.shuffle(specialCh.toList).head
val A = lowerCh ++ higherCh ++ numRando ++ specChrando
head
returns 单个元素,而 ++
期望输入是集合。尝试更改为使用 take(1)
而不是 head