@DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2013-12-30 13:00:42.071 -0500", hash_original_method = "236CE70381CAE691CF8D03F3D0A7E2E8", hash_generated_method = "34048EFAD324F63AAF648818713681BB" ) fun toUpperCase(string: String): String? { var changed = false val chars = string.toCharArray() for (i in chars.indices) { val ch = chars[i] if ('a' <= ch && 'z' >= ch) { changed = true chars[i] = (ch.code - 'a'.code + 'A'.code).toChar() } } return if (changed) { String(chars) } else string }
A locale independent version of toUpperCase .