Monday, September 7, 2009

String Array

strEmployeeName="Tester(Test)";
///
/// It will return Full name and FQN
///

///
///
public string[] SplitEmployeeNameFQN(string strEmployeeName)
{
string[] strInputValue = strEmployeeName.Split(';');
string[] arrReturn = new string[2];
//string employeeName = string.Empty;
string strFQN = string.Empty;
for (int i = 0; i < strInputValue.Length; i++)
{
if (!(strInputValue[i] == ""))
{
int startIndex = strInputValue[i].IndexOf("(");
strFQN = strInputValue[i].Substring(startIndex + 1);
strFQN = strFQN.Replace(")", "");
arrReturn[0] += strFQN.Trim() + ";";
arrReturn[1] += strInputValue[i].Remove(startIndex).Trim() + ";";
}
}

return arrReturn;
}