|
|
posted on January 19, 2012 05:35
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;
}
}
}
There are currently no comments, be the first to post one!