是否可以这样做:
/**
* Converts all of the characters in the string to upper case.
*
* @param str the string to be converted to uppercase
* @return the string converted to uppercase or empty string if the input was null
*/
fun String?.toUpperCase(): String = this?.toUpperCase() ?: ""
- 这会怎么样?这将使
toUpperCase
个零安全. - 我有什么问题?返回值为
this?.toUpperCase()
,
Is the only option to rename my extension function or is there a way to refer to the "super" function from within it?