Skip to content

Commit 3e1e4b6

Browse files
Add emptyString()
1 parent d7dc08e commit 3e1e4b6

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [Unreleased]
44

55
### Added
6+
- `emptyString()`
67
- `isNotNullNorBlank()` and `isNotNullNorEmpty()`
78
- `second()`, `third()`, `forth()`, `fifth()` and `penultimate()`
89
- `OrNull` variants for `second()`, `third()`, `forth()`, `fifth()` and `penultimate()`

kotlin-stdlib/api/kotlin-stdlib.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ public final class com/javiersc/kotlin/stdlib/CollectionsKt {
157157
}
158158

159159
public final class com/javiersc/kotlin/stdlib/StringsKt {
160+
public static final fun emptyString ()Ljava/lang/String;
160161
public static final fun isNotNullNorBlank (Ljava/lang/CharSequence;)Z
161162
public static final fun isNotNullNorBlank (Ljava/lang/String;)Z
162163
public static final fun isNotNullNorEmpty (Ljava/lang/CharSequence;)Z

kotlin-stdlib/commonMain/kotlin/Strings.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ public inline fun String?.isNotNullNorEmpty(): Boolean {
3636

3737
return this != null && isNotEmpty()
3838
}
39+
40+
public inline fun emptyString(): String = ""

kotlin-stdlib/commonTest/kotlin/StringsTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,9 @@ class StringsTest {
2727
assertTrue { notBlank.isNotNullNorBlank() }
2828
assertTrue { notBlank.isNotNullNorEmpty() }
2929
}
30+
31+
@Test
32+
fun empty_string() {
33+
assertTrue { emptyString() == "" }
34+
}
3035
}

0 commit comments

Comments
 (0)