I want to generate combinations of a string with iterable multiplication.I am try to get combination of string passed to my function.I am passing numbers and get combination of strings like 1 for abc,2 for def
fun generatexCombinations(valuePassed:String){
val list2 = listOf("A", "B", "C")
val list3 = listOf("D", "E", "F")
val list4 = listOf("G", "H", "I")
val list5 = listOf("J", "K", "L")
val list6 = listOf("M", "N", "O")
val list7 = listOf("P", "Q", "R", "S")
val list8 = listOf("T", "U", "V")
val list9 = listOf("W", "X", "Y", "Z")
val listCombination= mutableListOf<List<String>>()
val charArray= valuePassed.toCharArray()
for (char in charArray){
when(char.toString()){
"2"->listCombination.add(list2)
"3"->listCombination.add(list3)
"4"->listCombination.add(list4)
"5"->listCombination.add(list5)
"6"->listCombination.add(list6)
"7"->listCombination.add(list7)
"8"->listCombination.add(list8)
"9"->listCombination.add(list9)
}
}
//this is example of text "biryani"
val combinationOfStrings= list2 * list4*list7*list9*list2*list6*list4
//i want to generate above list to multiplied
// dynamically accroding to string value passed
}
how can i achieve it?
i am using iterable multiplication ,please refer website below
https://www.kotlinresources.com/library/kotlindiscretemathtoolkit/
'2' -> ...List<Triple<Triple<String, String, String>, String, String>, String, String>, which I can't imagine would be very useful. Can you explain more clearly what you want?