1
1
Fork 0

Replaced all usages of deprecated toUpperCase/toLowerCase with uppercase/lowercase calls

This commit is contained in:
Svetlana Isakova 2021-09-01 17:43:15 +02:00
parent ff47882ade
commit ce4c320273
16 changed files with 24 additions and 24 deletions

View File

@ -4,6 +4,6 @@ import atomictest.eq
fun main() {
val list = listOf('a', 'b', 'c', 'd')
val result =
list.map { "[${it.toUpperCase()}]" }
list.map { "[${it.uppercaseChar()}]" }
result eq listOf("[A]", "[B]", "[C]", "[D]")
}

View File

@ -2,9 +2,9 @@
package creatingClassesExercise4
fun main() {
val s: String = "Hello!"
println(s.toUpperCase())
println(s.toLowerCase())
val s = "Hello!"
println(s.uppercase())
println(s.lowercase())
}
/* Output:
HELLO!

View File

@ -7,7 +7,7 @@ Press <span class="shortcut">&shortcut:QuickJavaDoc;</span> when the caret is
on a class or a function usage, and IntelliJ IDEA will show you the available
documentation for this function or class.
Put the caret on the `String` type and its `toUpperCase()` and `toLowerCase()` member
Put the caret on the `String` type and its `uppercase()` and `lowercase()` member
functions, then use <span class="control">`Quick Documentation`</span>.
Press <span class="shortcut">&shortcut:EditorEscape;</span> to close the
quick documentation pop-up.

View File

@ -3,7 +3,7 @@
fun main() {
val s = "AbcD"
println(s.reversed())
println(s.toLowerCase())
println(s.lowercase())
}
/* Output:
DcbA

View File

@ -5,7 +5,7 @@ fun isPalindrome(s: String): Boolean =
s.reversed() == s
fun isPalIgnoreCase(s: String): Boolean =
isPalindrome(s.toLowerCase())
isPalindrome(s.lowercase())
fun main() {
println(isPalIgnoreCase("Mom")) // true

View File

@ -4,7 +4,7 @@ files:
visible: true
placeholders:
- offset: 170
length: 29
length: 27
placeholder_text: TODO()
- name: test/Tests.kt
visible: false

View File

@ -5,7 +5,7 @@ palindromes. "Bob" should now be considered a palindrome.
<div class="hint">
Use `toLowerCase()` to produce a `String` with all lower-case characters.
You can also use `toUpperCase()`.
Use `lowercase()` to produce a `String` with all lower-case characters.
You can also use `uppercase()`.
</div>

View File

@ -5,7 +5,7 @@ fun isPalindrome(s: String): Boolean =
s.reversed() == s
fun isPalIgnoreCase(s: String): Boolean =
isPalindrome(s.toLowerCase())
isPalindrome(s.lowercase())
fun isPalIgnoreSpecial(s: String): Boolean {
var onlyLetters = ""

View File

@ -3,7 +3,7 @@ files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 248
- offset: 246
length: 154
placeholder_text: TODO()
- name: test/Tests.kt

View File

@ -7,6 +7,6 @@ operator fun String.invoke(
) = f(this)
fun main() {
"mumbling" { it.toUpperCase() } eq
"mumbling" { it.uppercase() } eq
"MUMBLING"
}

View File

@ -20,7 +20,7 @@ class TestDataTypesExercise1 {
fun checkTypeMismatch() {
val output = runAndGetSystemOutput {
main()
}.toLowerCase()
}.lowercase()
Assert.assertTrue("The first line of the error the compiler produces is expected: Type mismatch",
output.contains("type")

View File

@ -3,13 +3,13 @@ import atomictest.*
fun main() {
val map = mapOf(1 to "one")
map[1]!!.toUpperCase() eq "ONE"
map.getValue(1).toUpperCase() eq "ONE"
map[1]!!.uppercase() eq "ONE"
map.getValue(1).uppercase() eq "ONE"
capture {
map[2]!!.toUpperCase()
map[2]!!.uppercase()
} eq "NullPointerException"
capture {
map.getValue(2).toUpperCase()
map.getValue(2).uppercase()
} eq "NoSuchElementException: " +
"Key 2 is missing in the map."
}

View File

@ -3,9 +3,9 @@ package safecalls
import atomictest.*
fun String.echo() {
trace(toUpperCase())
trace(uppercase())
trace(this)
trace(toLowerCase())
trace(lowercase())
}
fun main() {

View File

@ -3,7 +3,7 @@ package safeCallsAndTheElvisOperatorExercise1
import atomictest.eq
fun downcase(s: String?): String =
s?.toLowerCase() ?: ""
s?.lowercase() ?: ""
fun main() {
downcase(null) eq ""

View File

@ -4,9 +4,9 @@ files:
visible: true
placeholders:
- offset: 98
length: 59
length: 57
placeholder_text: fun downcase() {}
- offset: 172
- offset: 170
length: 49
placeholder_text: |-
/*

View File

@ -9,7 +9,7 @@ class TestSafeCallsAndTheElvisOperatorExercise1 {
val downcaseFunc = ::downcase
checkParametersOfTopLevelFunction(downcaseFunc, listOf("" to "kotlin.String?"))
val actual = downcaseFunc.call(s)
Assert.assertEquals("Wrong result for calling downcase(\"$s\")", s?.toLowerCase() ?: "", actual)
Assert.assertEquals("Wrong result for calling downcase(\"$s\")", s?.lowercase() ?: "", actual)
}
@Test