From 282772a0fc4b612c10b83f78f521300c097f9435 Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 19 Apr 2023 20:12:05 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../tangem/feature/onboarding/domain/PartWordFinder.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/features/onboarding/src/main/java/com/tangem/feature/onboarding/domain/PartWordFinder.kt b/features/onboarding/src/main/java/com/tangem/feature/onboarding/domain/PartWordFinder.kt index 6441764a34..46518bacce 100644 --- a/features/onboarding/src/main/java/com/tangem/feature/onboarding/domain/PartWordFinder.kt +++ b/features/onboarding/src/main/java/com/tangem/feature/onboarding/domain/PartWordFinder.kt @@ -4,9 +4,13 @@ import com.tangem.utils.extensions.isNotWhitespace /** [REDACTED_AUTHOR] + * Class which provides helper functions to determine lead or last part of words for suggestions */ internal class PartWordFinder { + /** + * Searches and return part of a word on the left side of the [cursorPosition] into the [text] + */ fun getLeadPartOfWord(text: String, cursorPosition: Int): String? { val charText = text.toCharArray().asList() if (cursorPosition > charText.size || cursorPosition < 0) { @@ -41,6 +45,10 @@ internal class PartWordFinder { return null } + /** + * Returns a substring of the [word] which excludes the first word part found on the left of [cursorPosition] in + * the [text] + */ fun getLastPartOfWord(text: String, word: String, cursorPosition: Int): String { val leadPart = getLeadPartOfWord(text, cursorPosition) ?: return ""