either

fun String.either(first: String, second: String): String

Extension function for the String class that toggles the string value between the provided first and second strings.

Return

The second string if the current string is equal to first, otherwise returns the first string.

Parameters

first

The first string to compare with.

second

The second string to compare with.