Capture Name

Hi All,

I have an name in string form , In complete name i want to skip the middle name (if there is present the middle name), and when there is only first and last name there is no requirement to change anything.
LIKE-
ex-1:- DANIEL JOHN HINEDXON (I want to remove john in complete name)
ex-2, MICHELE MADUXX (There is no requirement to remove anything)

Please, suggest me.

@Meenakshi6246

Split the string based on space and store it in array. If the count of array is 3,then remove middle word.

Hi
Can you do it, for me with an example, it helpful for me

@Meenakshi6246

If String1=“Lukas Krishnan CM”

Split the string

arr=String1.Split({" "},System.StringSplitOptions.None)

arr–> String array

Then,check the count of array.

count= arr.count

if count =3, then NewString=arr(0)+arr(2)
else NewString=String1

1 Like

@Meenakshi6246,

I have created a workflow based on a requirement.

Please let know if it is work out and also mark as solution if you satisfy with the answer.

Thanks,
Mohanraj.SSplit.zip (690.6 KB)

Hello @Meenakshi6246
Instead Splitting this data you can do it simply using an Assign Activity by assigning this code
System.Text.RegularExpressions.Regex.Replace(stringVariable.Trim,"(?= ) \w+ (?<= )|(?= ) \w+ (?<= )"," ")
it’ll remove middle name check this workflow for better understanding
RegexReplace.xaml (4.5 KB)

3 Likes

Hi @vickydas thanks for help, its working fine.

Thank you…:slight_smile:

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