I have to sort a list based on the searched text position in the string i.e. if the searched value appears first in the string then its position should be first in the list, if it appears second in the string then it should be second but all the strings with first word as searched value should appear first in the list.
For example, input strings are:
- Chris is a good person
- Every person should be like chris
- Not every person is chris
- person like chris are good
The searched value is "person".
Output should be :
- person like chris are good
- Every person should be like chris
- Not every person is chris
- Chris is a good person