Can anyone explain the below code in detail

String.Join(" ",value1.Split({" "},StringSplitOptions.None).ToList.Except(value2.Split({" "},StringSplitOptions.None).ToList))
where this code finds the word missing from value1. I got this VB.NET code some where,but i cant understand it perfectly…where i drag writeline activity and i got the answer.

value1 : Welcome to Hello World
value2: Welcome Hello World
output: “to”

Hi @saneeth_kandukuri,

you are split the value using space so it will return 4 values like

  1. Welcome
  2. to
  3. Hello
  4. World

now you are converting into List -(List1)

you are split the value using space so it will return 4 values like

  1. Welcome
  2. Hello
  3. World

now you are converting into List-(List2)

List1.Except(List2)

the above code will return only not there in the List2 value from List1 so as per our record it will return “to”

List1.Except(List2).ToList - (List3)
now you are converting into list

String.join(" ",List3)

so it will join the list of values using " " (space) and it will return as string.

Regards,
Arivu :slight_smile:

3 Likes

super tanq for ur help

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.