• Login

Snippets

19
public void NameSplit(string name)
{
 if (name.Length > 0)
 {
  // Check for a comma
  if (name.IndexOf(",") > 0)
  {
   LastName = name.Substring(0, name.IndexOf(",")).Trim();
   FirstName = name.Substring(name.IndexOf(",") + 1).Trim();
  }
  else if (name.IndexOf(" ") > 0)
  {
   FirstName = name.Substring(0, name.IndexOf(" ")).Trim();
   LastName = name.Substring(name.IndexOf(" ") + 1).Trim();
  }
  else
  {
   FirstName = "-";
   LastName = name;
  }
 }
}

Post Rating

Comments

There are currently no comments, be the first to post one!

Post Comment

Name (required)

Email (required)

Website