object test_string {
def main(args: Array[String]): Unit = {
val cbdshb = Array(1, 2, 3, 4, 5, 6, 5)
val cdsv = cbdshb.zipWithIndex.filter(f => f._2 % 2 == 0).map(f => f._1).map(x => BigDecimal.valueOf(x.toString.toDouble).toInt).toArray
println(cdsv.mkString("Array(", ", ", ")"))
}
结果:
Array(1, 3, 5, 5)