fork download
  1. object Main extends App {
  2. val emp: List[String] = List("customer_bal_history_1_36","customer_bal_history_1_36_1","customer_bal_history_1_36_2","customer_bal_history_1_36_3","customer_credit_history_37_72_1","customer_credit_history_37_72_2","customer_credit_history_37_72_3","employee_1", "employee_10", "address","pincode","domain_1","domain_2","vehicle_1","vehicle_2","vendor_account_1","vendor_account_2")
  3. println(emp.groupBy(
  4. _.split("_")
  5. .takeWhile(s => !Character.isDigit(s.charAt(0)))
  6. .mkString("_")
  7. ).values.toList)
  8. }
Success #stdin #stdout 0.75s 73700KB
stdin
Standard input is empty
stdout
List(List(vehicle_1, vehicle_2), List(employee_1, employee_10), List(domain_1, domain_2), List(customer_bal_history_1_36, customer_bal_history_1_36_1, customer_bal_history_1_36_2, customer_bal_history_1_36_3), List(customer_credit_history_37_72_1, customer_credit_history_37_72_2, customer_credit_history_37_72_3), List(vendor_account_1, vendor_account_2), List(address), List(pincode))