Check this out:
string text = "apr,may,jun,jul,aug";
string[] months = text.Split(',');
string result = "";
if (months.Length > 2)
{
result = months[0].Trim() + " to " + months[months.Length - 1].Trim();
}
else if (months.Length > 1)
{
result = months[0].Trim() + " & " + months[months.Length - 1].Trim();
}
else
{
result = months[0].Trim();
}
Console.WriteLine(result);