Suppose we have a toy utility method to capitalize strings:
fun String?.capitalize(): String? {
return when {
isNullOrBlank() -> this
length == 1 -> uppercase()
else -> this[0].uppercase() + substring(1)
}
}Your task is to add some logging to this method so it prints the input string both before capitalization and after capitalization in the following format:
Before: string
After: Stringwhere string is an example of the input string. As you can see, the method has three execution paths and they all must be logged.