From 8c3de54d0cf57dbbb3a04f93fb2bdfe2ccbd6fbe Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 8 Aug 2017 13:46:54 -0700 Subject: [PATCH] Add a matches function. --- .../kotlin/org/nwapw/abacus/function/Documentation.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/nwapw/abacus/function/Documentation.kt b/src/main/kotlin/org/nwapw/abacus/function/Documentation.kt index fc9205b..3b94845 100644 --- a/src/main/kotlin/org/nwapw/abacus/function/Documentation.kt +++ b/src/main/kotlin/org/nwapw/abacus/function/Documentation.kt @@ -14,4 +14,13 @@ package org.nwapw.abacus.function */ data class Documentation(val codeName: String, val name: String, val description: String, val longDescription: String, - val type: DocumentationType) \ No newline at end of file + val type: DocumentationType) { + + fun matches(other: String): Boolean { + return codeName.toLowerCase().contains(other.toLowerCase()) || + name.toLowerCase().contains(other.toLowerCase()) || + description.toLowerCase().contains(other.toLowerCase()) || + longDescription.toLowerCase().contains(other.toLowerCase()) + } + +} \ No newline at end of file