Re: Convert Java code to Dart

51 views
Skip to first unread message

Suzuki Tomohiro

unread,
Jun 3, 2021, 9:45:21 PM6/3/21
to ZA, Flutter Development (flutter-dev)
Can you explain how the two pieces of code achieve matching é for respectively? (Both Java and Dart)

On Thu, Jun 3, 2021 at 21:17 ZA <zahra...@gmail.com> wrote:
Hi,

I'm new here so please bear with me if I make any mistake.

I'm trying to convert this Java code to Dart

Pattern word = Pattern.compile(TextUtils.join("['’]?", searchQuery.split("")), Pattern.CASE_INSENSITIVE);
Matcher match = word.matcher(normalizedText);


So far I have been unsuccessful. This is what I have done so far:

var j1 = query.replaceAll(new RegExp(r"(?<!^)(\B|b)(?!$)"), "['’‘]?").trim().toLowerCase().split(" ");
print(j1);

final List<Match> matches = <Match>[];
for (final String token in j1) {
matches.addAll(token.allMatches(refindSource));
}


This doesn't match anything. I'm trying to match the search query with paragraph content with or without apostrophe. Like if a user searches for Renee it should match Renée’s in the source text.

I appreciate all the help.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/a9cb2893-64c0-429d-8c32-634cdbd0425dn%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages