Add samples for String/CharSequence filter & filterNot (#3390)

* Add samples for String/CharSequence filter & filterNot
* Link samples to stdlib generator
This commit is contained in:
Segun Famisa
2020-05-18 22:15:41 +02:00
committed by GitHub
parent 25f83e941c
commit d6a8003743
3 changed files with 24 additions and 4 deletions
@@ -79,6 +79,24 @@ class Strings {
assertPrints(proteins.take(5).toList(), "[Isoleucine, Arginine, Glycine, Arginine, Glutamine]")
}
@Sample
fun filter() {
val text = "a1b2c3d4e5"
val textWithOnlyDigits = text.filter { it.isDigit() }
assertPrints(textWithOnlyDigits, "12345")
}
@Sample
fun filterNot() {
val text = "a1b2c3d4e5"
val textWithoutDigits = text.filterNot { it.isDigit() }
assertPrints(textWithoutDigits, "abcde")
}
@Sample
fun zip() {
val stringA = "abcd"