So I have created some lines of code that can take two strings, split them, and compared each word of 1 string to the other and said that the same word exists in both if so , but would this be an efficient way to compare words over a large volume of text, talking of 300- 10000 words, because string, split works by arrays so would it screw over the computer memory? sorry I'm still learning a level cs so hardly know any terminology.
I heard that regex would be extremely good at this kind of thing but its pretty confusing.
static void Main(string[] args)
{
string text1 = "yeet went the black fox cry went the chicken";
string text2 = "yeet the fox cry the ";
string[] spaced1 = text1.Split(" ");
string[] spaced2 = text2.Split(" ");
for (int s = 0; s < spaced1.Length; s++)
{
if (spaced1[s]== spaced2[s])
{
Console.WriteLine("same word");
Console.WriteLine(spaced1[s]);
}
}
Console.ReadLine();
}
this specific code gives the results I want, and I still need to make it so it splits at comas and full stops etc.