Some times we have a string which has the some points with different serial numbers like this...
1.Good Team Player, Fast Learner and a Hard. 2. Worker.Organised and Well Structured at Work. 3. Committed to deadlines and Schedules. 4.Honest, Sincere with high level of Integrity.
and we have to split the string as like this....
1.Good Team Player, Fast Learner and a Hard.
2. Worker.Organised and Well Structured at Work.
3. Committed to deadlines and Schedules.
4.Honest, Sincere with high level of Integrity.
so here is a simple code to split it using c#
string s = "1.Good Team Player, Fast Learner and a Hard. 2. Worker.Organised and Well Structured at Work. 3. Committed to deadlines and Schedules. 4.Honest, Sincere with high level of Integrity.
";
int count=0;
string s1 = "";
for(int i=0;i<s.Length;i++)
{
if (Char.IsNumber(s[i])&&s[i + 1] == '.')
{
s1 = "";
for (int k =i ; k < s.Length; k++)
{
s1 += s[k];
if(k<s.Length-1)
{
if (Char.IsNumber(s[k+1]) && s[k + 2] == '.')
break;
}
count++;
}
Response.WriteLine(s1);
i = count;
}
}
}
Now you will have the result as like you want...
No comments:
Post a Comment