Splitting string Firstname and last name dynamic values

Hi All,

I am splitting customer name first name and last name which is dynamic, I am splitting based on space and “&” but some times I am getting names single word that time last name is null and getting index out bound array how to handle this
Example: “HONEYWELL” this word i am getting single word and last name variable will be null


You can add a check like below -

If yourstring.Contains(" ") or yourstring.Contains("&") Then
    //last name exists
  //last name doesn't exists

Karthik Byggari