I will suggest you to change your logic .
instead of spliting string on the index split on the where you have WhiteSpace.
string input = "Flat No-4324,Near Ganga Institute, Tehsil-Raipur, Distt-Banglore,State-Karnataka, Pin-644487, India";
string[] Words = input.Split(',');
char[] L1,L2,L3,L4,L5 = new char[20];
L1[0] = L2[0] = L3[0] = L4[0] = L5[0] = ' ';
bool P1, P2, P3, P4, P5;
P1 = P2 = P3 = P4 =P5 = true;
int spaceleft = 0;
foreach (string s in Words)
{
if (P1)
{
spaceleft = 20 -L1.Length ;
if (spaceleft > s.Length)
{
int j = 0;
char[] wordchar = s.ToCharArray();
for(int i = L1.Length+1;i<20;i++)
{
L1[i]= wordchar[j];
}
}
else
{
P1 = false;
foreach (char c in L1)
Console.Write(c);
Console.WriteLine();
}
}
else if (P2)
{
spaceleft = 20 -L2.Length ;
if (spaceleft > s.Length)
{
int j = 0;
char[] wordchar = s.ToCharArray();
for(int i = L2.Length+1;i<20;i++)
{
L2[i]= wordchar[j];
}
}
else
{
P2 = false;
foreach (char c in L2)
Console.Write(c);
Console.WriteLine();
}
}
else if (P3)
{
spaceleft = 20 -L3.Length ;
if (spaceleft > s.Length)
{
int j = 0;
char[] wordchar = s.ToCharArray();
for(int i = L3.Length+1;i<20;i++)
{
L3[i]= wordchar[j];
}
}
else
{
P3 = false;
foreach (char c in L3)
Console.Write(c);
Console.WriteLine();
}
}
else if (P4)
{
spaceleft = 20 -L4.Length ;
if (spaceleft > s.Length)
{
int j = 0;
char[] wordchar = s.ToCharArray();
for(int i = L4.Length+1;i<20;i++)
{
L4[i]= wordchar[j];
}
}
else
{
P4 = false;
foreach (char c in L4)
Console.Write(c);
Console.WriteLine();
}
}
else if (P5)
{
spaceleft = 20 - L5.Length;
if (spaceleft > s.Length)
{
int j = 0;
char[] wordchar = s.ToCharArray();
for (int i = L5.Length + 1; i < 20; i++)
{
L5[i] = wordchar[j];
}
}
else
{
P5 = false;
foreach (char c in L5)
Console.Write(c);
Console.WriteLine();
}
}
else
{
Console.WriteLine("Address too long.");
}
}
I wrote this sample code in very pathatic manner, so you have to refactor it and then use it. there may be some execptions too