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
@@ -557,6 +557,7 @@ object Filtering : TemplateGroupBase() {
}
specialFor(Strings, CharSequences) {
sample("samples.text.Strings.filter")
returns("SELF")
doc { "Returns a ${f.collection} containing only those characters from the original ${f.collection} that match the given [predicate]." }
body { """return filterTo(StringBuilder(), predicate)${toResult(f)}""" }
@@ -686,6 +687,7 @@ object Filtering : TemplateGroupBase() {
}
specialFor(Strings, CharSequences) {
sample("samples.text.Strings.filterNot")
returns("SELF")
doc { "Returns a ${f.collection} containing only those characters from the original ${f.collection} that do not match the given [predicate]." }
body { """return filterNotTo(StringBuilder(), predicate)${toResult(f)}""" }