Search code examples
c#textfull-text-search

c# find word and parts of that word seperated by spaces


I have a lot of texts and a search term, for example 'simcard'. I then want all places where 'simcard' appears, but also 'sim card', for example. How should I achieve that?

You can of course delete the spaces from all texts you search. And then find the text with text.IndexOf('simcard') or text.Contains('simcard'). Then I detect the texts that contain 'simcard', 'sim card' etc. But I also want to highlight all occurrences later in the list of texts. How do I find the position of, for example, 'SIM card'?


Solution

  • I solved it by using FreeText.