diff --git a/AlmostDone/multiRowStringsTheory/task.md b/AlmostDone/multiRowStringsTheory/task.md index 7e3f3d3d..f8d587bf 100644 --- a/AlmostDone/multiRowStringsTheory/task.md +++ b/AlmostDone/multiRowStringsTheory/task.md @@ -1,6 +1,6 @@ ### 1. What are multiline strings? -When working with long strings, it is most convenient to use so-called [multiline strings](https://kotlinlang.org/docs/coding-conventions.html#strings). +When working with long strings, the most convenient approach is to use so-called [multiline strings](https://kotlinlang.org/docs/coding-conventions.html#strings). Unlike regular strings, they are enclosed in triple quotes: ```kotlin // A regular string: @@ -16,13 +16,13 @@ val multiRowString = """ ### 2. The `trimIndent` and `trimMargin` functions -For convenient work with such strings, there are two functions: [`trimIndent`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim-indent.html) and [`trimMargin`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim-margin.html). -`trimIndent` detects the common minimal indent of all the input lines, -removes it from every line, and also removes the first and the last lines +For convenient handling of such strings, Kotlin provides two functions: [`trimIndent`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim-indent.html) and [`trimMargin`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim-margin.html). +`trimIndent` detects the smallest common indentation of all the input lines, +removes it from every line, and also discards the first and the last lines if they are blank. `trimMargin` trims leading whitespace characters -followed by `marginPrefix` from every line of a source string and removes -the first and the last lines if they are blank. +followed by `marginPrefix` from every line of a source string and also removes +the first and last lines if they are blank. For example, check out the following code: ```kotlin @@ -59,6 +59,6 @@ Second line of the string In the first case, the string will have extra indents and margins. Also, each line in the string has the `*` symbol. In the second case, the string looks better, but it still has an extra symbol in each line. -The last case looks as the best option. +The last case looks like the best option. Therefore, when working with multiline strings, such functions are a great help.