Skip to content

Commit

Permalink
Simplify TrimmedText
Browse files Browse the repository at this point in the history
  • Loading branch information
neonailol committed Jun 27, 2018
1 parent eccf797 commit 92240e0
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/alltypes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ Kactoos.
| [nnl.rocks.kactoos.func.TimedFunc](../nnl.rocks.kactoos.func/-timed-func/index.md) | Function that gets interrupted after a certain time has passed. |
| [nnl.rocks.kactoos.text.TrimmedLeftText](../nnl.rocks.kactoos.text/-trimmed-left-text/index.md) | Text without control characters (char <= 32) only from left. |
| [nnl.rocks.kactoos.text.TrimmedRightText](../nnl.rocks.kactoos.text/-trimmed-right-text/index.md) | Text without control characters (char <= 32) only from right. |
| [nnl.rocks.kactoos.text.TrimmedText](../nnl.rocks.kactoos.text/-trimmed-text/index.md) | Text without control characters (char <= 32) from both ends. |
| [nnl.rocks.kactoos.text.TrimmedText](../nnl.rocks.kactoos.text/-trimmed-text/index.md) | Text without whitespace characters from both ends. |
| [nnl.rocks.kactoos.scalar.True](../nnl.rocks.kactoos.scalar/-true/index.md) | Logical truth. |
| [nnl.rocks.kactoos.func.UncheckedBiFunc](../nnl.rocks.kactoos.func/-unchecked-bi-func/index.md) | BiFunc that doesn't throw checked [Exception](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-exception/index.html). |
| [nnl.rocks.kactoos.func.UncheckedBiProc](../nnl.rocks.kactoos.func/-unchecked-bi-proc/index.md) | BiProc that doesn't throw checked [Exception](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-exception/index.html). |
Expand Down
5 changes: 0 additions & 5 deletions docs/nnl.rocks.kactoos.list/-mapped/to-string.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/nnl.rocks.kactoos.text/-text-envelope/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ Text envelope that provides equals and hashCode methods.
| [SwappedCaseText](../-swapped-case-text/index.md) | `class SwappedCaseText : `[`TextEnvelope`](./index.md)<br>Swaps the case of a Text changing upper and title case to lower case, and lower case to upper case. |
| [TextBase64](../-text-base64/index.md) | `class TextBase64 : `[`TextEnvelope`](./index.md)<br>Encodes the origin text using the Base64 encoding scheme. |
| [TextOf](../-text-of/index.md) | `class TextOf : `[`TextEnvelope`](./index.md)<br>TextOf |
| [TrimmedText](../-trimmed-text/index.md) | `class TrimmedText : `[`TextEnvelope`](./index.md)<br>Text without control characters (char &lt;= 32) from both ends. |
| [TrimmedText](../-trimmed-text/index.md) | `class TrimmedText : `[`TextEnvelope`](./index.md)<br>Text without whitespace characters from both ends. |
2 changes: 1 addition & 1 deletion docs/nnl.rocks.kactoos.text/-trimmed-text/-init-.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

`TrimmedText(origin: `[`Text`](../../nnl.rocks.kactoos/-text/index.md)`)``TrimmedText(origin: `[`KText`](../../nnl.rocks.kactoos/-k-text.md)`)`

Text without control characters (char &lt;= 32) from both ends.
Text without whitespace characters from both ends.

There is no thread-safety guarantee.

Expand Down
4 changes: 2 additions & 2 deletions docs/nnl.rocks.kactoos.text/-trimmed-text/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

`class TrimmedText : `[`TextEnvelope`](../-text-envelope/index.md)

Text without control characters (char &lt;= 32) from both ends.
Text without whitespace characters from both ends.

There is no thread-safety guarantee.

Expand All @@ -15,7 +15,7 @@ There is no thread-safety guarantee.

| Name | Summary |
|---|---|
| [&lt;init&gt;](-init-.md) | `TrimmedText(origin: `[`Text`](../../nnl.rocks.kactoos/-text/index.md)`)``TrimmedText(origin: `[`KText`](../../nnl.rocks.kactoos/-k-text.md)`)`<br>Text without control characters (char &lt;= 32) from both ends. |
| [&lt;init&gt;](-init-.md) | `TrimmedText(origin: `[`Text`](../../nnl.rocks.kactoos/-text/index.md)`)``TrimmedText(origin: `[`KText`](../../nnl.rocks.kactoos/-k-text.md)`)`<br>Text without whitespace characters from both ends. |

### Inherited Functions

Expand Down
2 changes: 1 addition & 1 deletion docs/nnl.rocks.kactoos.text/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Text.
| [TextOf](-text-of/index.md) | `class TextOf : `[`TextEnvelope`](-text-envelope/index.md)<br>TextOf |
| [TrimmedLeftText](-trimmed-left-text/index.md) | `class TrimmedLeftText : `[`Text`](../nnl.rocks.kactoos/-text/index.md)<br>Text without control characters (char &amp;lt;= 32) only from left. |
| [TrimmedRightText](-trimmed-right-text/index.md) | `class TrimmedRightText : `[`Text`](../nnl.rocks.kactoos/-text/index.md)<br>Text without control characters (char &amp;lt;= 32) only from right. |
| [TrimmedText](-trimmed-text/index.md) | `class TrimmedText : `[`TextEnvelope`](-text-envelope/index.md)<br>Text without control characters (char &lt;= 32) from both ends. |
| [TrimmedText](-trimmed-text/index.md) | `class TrimmedText : `[`TextEnvelope`](-text-envelope/index.md)<br>Text without whitespace characters from both ends. |
| [UncheckedText](-unchecked-text/index.md) | `class UncheckedText : `[`Text`](../nnl.rocks.kactoos/-text/index.md)<br>Text that doesn't throw checked [Exception](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-exception/index.html). |
| [UpperText](-upper-text/index.md) | `class UpperText : `[`Text`](../nnl.rocks.kactoos/-text/index.md)<br>Text in upper case. |
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import nnl.rocks.kactoos.KText
import nnl.rocks.kactoos.Text

/**
* Text without control characters (char <= 32) from both ends.
* Text without whitespace characters from both ends.
*
* There is no thread-safety guarantee.
*
* @since 0.1
*/
class TrimmedText(origin: KText) : TextEnvelope({ origin().trim { it <= ' ' } }) {
class TrimmedText(origin: KText) : TextEnvelope({ origin().trim() }) {

constructor(origin: Text) : this({ origin.asString() })
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TrimmedTextTest {
@Test
fun convertsText() {
assertEquals(
TrimmedText({ " Hello! \t " }).asString(),
TrimmedText { " Hello! \t " }.asString(),
"Hello!",
"Can't trim a text"
)
Expand All @@ -17,7 +17,7 @@ class TrimmedTextTest {
@Test
fun trimmedBlankTextIsEmptyText() {
assertEquals(
TrimmedText({ " \t " }).asString(),
TrimmedText { " \t " }.asString(),
"",
"Can't trim a blank text"
)
Expand Down

0 comments on commit 92240e0

Please sign in to comment.