Find out if string list items startswith another item from another list

Yushox

I'd like to loop over a string list, and find out if the items from this list start with one of the item from another list.

So I have something like:

List<string> firstList = new List<string>();
firstList.Add("txt random");
firstList.Add("text ok");
List<string> keyWords = new List<string>();
keyWords.Add("txt");
keyWords.Add("Text");
FreeAsInBeer

You can do that using a couple simple for each loops.

foreach (var t in firstList) {
    foreach (var u in keyWords) {
        if (t.StartsWith(u) {
            // Do something here.
        }
    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Find out if string list items startswith another item from another list

From Dev

Fastest way of updating items of one list from another using StartsWith

From Dev

find lists that start with items from another list

From Dev

Excluding items from a list that exist in another list

From Dev

How to create list of items from another list

From Dev

Name the first item from a list that is not in another list

From Dev

Find list in another list

From Dev

Hide selected item & show another item instead from a list of items in jquery

From Dev

Java 8 streams: find items from one list that match conditions calculated based on values from another list

From Dev

How to filter one list of items from another list of items?

From Dev

Find and replace each instance of a single string with another from a list or file

From Dev

Create a list with items from another list at indices specified in a third list

From Dev

Remove list of items from another file in bash

From Dev

Look for a string object from a list in another list

From Dev

Copy list of items to another list

From Dev

Add another item to a List<>

From Dev

Navigate to another screen from Flat list item

From Dev

Add List Item to another list

From Dev

How to iterate a python list and compare items in a string or another list

From Dev

String in list multiplied by item in another list, printed on separate lines

From Dev

Check if a Python list item contains a string inside another list

From Dev

Get item in list by startswith

From Dev

How can i select random items from a set of two lists and then remove that set of items from another list built out of all the possibilities

From Dev

Checking if List contains all items from another list

From Dev

Remove items from a List which are in another List by a specific property?

From Dev

Using LINQ to remove items from a list that do not apear in another list

From Dev

Remove Items from sub list matching another sub list with Linq

From Dev

removing items from list that exist in another list based on an ID member

From Dev

Remove Items from sub list matching another sub list with Linq

Related Related

  1. 1

    Find out if string list items startswith another item from another list

  2. 2

    Fastest way of updating items of one list from another using StartsWith

  3. 3

    find lists that start with items from another list

  4. 4

    Excluding items from a list that exist in another list

  5. 5

    How to create list of items from another list

  6. 6

    Name the first item from a list that is not in another list

  7. 7

    Find list in another list

  8. 8

    Hide selected item & show another item instead from a list of items in jquery

  9. 9

    Java 8 streams: find items from one list that match conditions calculated based on values from another list

  10. 10

    How to filter one list of items from another list of items?

  11. 11

    Find and replace each instance of a single string with another from a list or file

  12. 12

    Create a list with items from another list at indices specified in a third list

  13. 13

    Remove list of items from another file in bash

  14. 14

    Look for a string object from a list in another list

  15. 15

    Copy list of items to another list

  16. 16

    Add another item to a List<>

  17. 17

    Navigate to another screen from Flat list item

  18. 18

    Add List Item to another list

  19. 19

    How to iterate a python list and compare items in a string or another list

  20. 20

    String in list multiplied by item in another list, printed on separate lines

  21. 21

    Check if a Python list item contains a string inside another list

  22. 22

    Get item in list by startswith

  23. 23

    How can i select random items from a set of two lists and then remove that set of items from another list built out of all the possibilities

  24. 24

    Checking if List contains all items from another list

  25. 25

    Remove items from a List which are in another List by a specific property?

  26. 26

    Using LINQ to remove items from a list that do not apear in another list

  27. 27

    Remove Items from sub list matching another sub list with Linq

  28. 28

    removing items from list that exist in another list based on an ID member

  29. 29

    Remove Items from sub list matching another sub list with Linq

HotTag

Archive