-3

I want find a string array in other string array. How I do that?

Example:

string[] a = {"a","b","c","d","e","f","g","c","d","e"}

string[] b = {"d","e"}

How find b in a, I need get the index of all instances.

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
  • what have you ***tried yourself*** so far? what problems did you encounter? what have you researched? i recommend [taking the tour](https://stackoverflow.com/tour), as well as reading [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and [what's on topic](https://stackoverflow.com/help/on-topic). – Franz Gleichmann Jun 30 '21 at 18:30
  • Upvoted - SO can be a mean place the [linked answer](https://stackoverflow.com/questions/7324177/) has 9 upvotes and here a new member gets clubbed to the ground. – surfmuggle Dec 26 '22 at 17:40

1 Answers1

-2

I would suggest you search a bit of the documentation to understand more of the language but anyway I'll try to explain what you can do

You can do a for loop going through the a array and inside you do a for loop going through the b array, if a[index] = b[index2] you break out of the a loop and put the index in a new array that you initialized before

If you need more help than that say but I recommend going through more documentation and a few videos and learn a bit more the basics

Dharman
  • 30,962
  • 25
  • 85
  • 135
João Garrido
  • 69
  • 3
  • 8