Renamed `everyFifthNonWhitespace` to `everyFifthNonSpace` to avoid confusion with whitespaces
https://youtrack.jetbrains.com/issue/EDC-421
This commit is contained in:
parent
50b127aaf1
commit
6c322c815e
|
@ -1,7 +1,7 @@
|
|||
// Summary1/Task6.kt
|
||||
package summaryIExercise6
|
||||
|
||||
fun everyFifthNonWhitespace(s: String) {
|
||||
fun everyFifthNonSpace(s: String) {
|
||||
var i = 1
|
||||
for (c in s) {
|
||||
if (i % 5 == 0 && c != ' ') {
|
||||
|
@ -12,7 +12,7 @@ fun everyFifthNonWhitespace(s: String) {
|
|||
}
|
||||
|
||||
fun main() {
|
||||
everyFifthNonWhitespace("abc d e fgh ik")
|
||||
everyFifthNonSpace("abc d e fgh ik")
|
||||
}
|
||||
/* Output:
|
||||
e
|
||||
|
|
|
@ -3,7 +3,7 @@ files:
|
|||
- name: src/Task.kt
|
||||
visible: true
|
||||
placeholders:
|
||||
- offset: 91
|
||||
- offset: 86
|
||||
length: 109
|
||||
placeholder_text: TODO()
|
||||
- name: test/Tests.kt
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
## Summary 1 (#6)
|
||||
|
||||
Implement `everyFifthNonWhitespace()` to display every fifth non-whitespace
|
||||
character in the given text. For example, `everyFifthNonWhitespace("abc d e fgh
|
||||
ik")` displays the characters `e` (fifth character if not counting
|
||||
whitespaces) and `k` (tenth).
|
||||
Implement `everyFifthNonSpace()` to display every fifth non-space
|
||||
character in the given text. For example, `everyFifthNonSpace("abc d e fgh
|
||||
ik")` displays the characters `e` (fifth character if not counting spaces) and
|
||||
`k` (tenth).
|
||||
|
|
|
@ -15,7 +15,7 @@ class TestSummaryIExercise6 {
|
|||
.joinToString("\n")
|
||||
runAndCheckSystemOutput("Wrong result for 'everyFifthNonWhitespace()'",
|
||||
expected) {
|
||||
everyFifthNonWhitespace(s)
|
||||
everyFifthNonSpace(s)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue