How to Split first name and lastname dynamically

Hi @Sriram07 ,

In order to get the common names, first split each word in the string and add to an array. Then compare 2 arrays.
for eg,
Assign String array, Str_Array1 = String1.Split(" "c)
String Array, Str_Array2=String2.Split(" "c)
If you want to get the common names as a single string,
Assign String Common= String.Join(" ",Str_Array1.Intersect(Str_Array2).ToArray)
Just like i/p → “sharukh s khan” and “salman s khan” ;output string= “s khan”

If you want to get each common word separately,
Assign string array, Common_Arr= Str_Array1.Intersect(Str_Array2).ToArray
Common_Arr(0), Common_Arr(1) etc will return the common values, otherwise loop through a “for each” activity in the array “Common_Arr”.

Warm regards,
Nimin

1 Like