Extraction of last name value from Full name word


I am trying to extract the Last name from the String variable
i used
FullName = Sreshta maruvada
FirstName = FullName.Split({" “},stringSplitOptions.RemoveEmptyEntries)(0)
LastName = FullName.Replace(fullName.Split(” “c)(0),”")

Last name is displaying as empty , not extracting last name value

firstName = FullName.Substring(0,fullname.LastIndexOf(" “))
lastName = FullName.Substring(FullName.LastIndexOf(” ")+1)


Can you try the following expressions (as I mentioned your previous post)?

firstName = System.Text.RegularExpressions.Regex.Match(fullName,"^\w+").Value

lastName = System.Text.RegularExpressions.Regex.Match(fullName,"(?<=^\w+\s).+").Value


I tied your solution , Last name value is displaying empty

I tried your solution, last name value is displaying the First name value instead of last name

it’s working for me @Vasundhara_Pakkurthi

Main.xaml (6.3 KB) check this sample

Yeah i wrongly assinged Full Name value , thanks working now

good cheers
close this thread