Android Question Find word in jumbled letters

Status
Not open for further replies.

DonManfred

Expert
Licensed User
Longtime User
He is not searching for any anagrams. He is searching for a way to find out whether a word in a list is inside this string.

B4X:
'I have some letters say:
'  XJBEFOXFRZ
'Dim t As String = "XJBEFOXFRZ"
Dim t As String = "The wolf is hunting the fox while the cat drink milk from the cow"
t = t.ToUpperCase
'Now Lets say my word List:
'
'  CAT, DOG, COW, FOX, WOLF
Dim l As List
l.Initialize
l.AddAll(Array As String ("CAT", "DOG", "COW", "FOX", "WOLF"))
'
'I need To see If there are any words from the word List In my String.
'Any ideas?
For i = 0 To l.Size-1
   If t.IndexOf(l.Get(i)) > -1 Then
     Log("The String '"&t&"' contains the word '"&l.Get(i)&"'")
   End If
Next
'The String 'THE WOLF IS HUNTING THE FOX WHILE THE CAT DRINK MILK FROM THE COW' contains the word 'CAT'
'The String 'THE WOLF IS HUNTING THE FOX WHILE THE CAT DRINK MILK FROM THE COW' contains the word 'COW'
'The String 'THE WOLF IS HUNTING THE FOX WHILE THE CAT DRINK MILK FROM THE COW' contains the word 'FOX'
'The String 'THE WOLF IS HUNTING THE FOX WHILE THE CAT DRINK MILK FROM THE COW' contains the word 'WOLF'
 
Last edited:
Upvote 0
Status
Not open for further replies.
Top