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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user