E EX_killer New Member Sep 17, 2019 #1 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: Sep 23, 2019
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!
Erel B4X founder Staff member Licensed User Longtime User Sep 18, 2019 #2 Best way is to use B4XSet from B4XCollections: Code: Copy 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 Upvote 0
Best way is to use B4XSet from B4XCollections: Code: Copy 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
E EX_killer New Member Sep 19, 2019 #3 Erel said: Best way is to use B4XSet from B4XCollections: Code: Copy 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 Click to expand... Thanks! Anyway to do it with the select-case method? Upvote 0
Erel said: Best way is to use B4XSet from B4XCollections: Code: Copy 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 Click to expand... Thanks! Anyway to do it with the select-case method?