Android Question Text-to-Speech filter program help

EX_killer

New Member
Hello, I'm a complete beginner working on some examples. I've followed another tutorial creating a basic Text-to-Speech program and I'm trying to add a swear word filter. I have had limited success with only one case so far and looking for some help.

Is there a way to add a variable to Select-Case so that I can cover many cases/swear words at once? Also how can I make it work regardless of letter-case ("F*ck", "f*ck").

Any help is greatly appreciated!
 
Last edited:

EX_killer

New Member
Best way is to use B4XSet from B4XCollections:
B4X:
Dim FilteredWords As B4XSet 'global

 FilteredWords = B4XCollections.CreateSet2(File.ReadList(File.DirAssets, "ExcludedWordsMakeSureThatTheyAreLowerCased.txt"))

If FilteredWords.Contains(EditText1.Text.ToLower) Then
'not good
End If

Thanks! Anyway to do it with the select-case method?
 
Upvote 0
Top