Error in a variable, how to analyze the code?

I started creating applications for the phone, and I’m just starting to learn how to write code on my own, for this reason I take the code partly from the Internet. Now I have one theme of two applications and I looked at both codes and realized that they are more similar … Who knows how to avoid this? What would be the code for each unique?
Looking for a solution on the Internet, I found such a service, it seems to help, but maybe someone worked with it, what can you say?

fun main() {
    val str = "A:B:C"
    val delim = ":"
 
    val list = str.split(delim)
 
    println(list)    // [A, B, C]
}