...Technology Simplified

Tuesday, April 24, 2012

How to split the string based on criteria

No comments :
protected void Button1_Click(object sender, EventArgs e)
{
string k1 = "";
string str = "AAABUS6666666 01 AAAB,INC. 1105070522AAABUS9147930 21 0008060362Smith John 540 N.VIA VALVERDEAAABUS7777777 01 AAAB,INC. 1105070522AAABUS9147930 21 0008060362Carillo Dave 201 Verdugo AveAAABUS8888888 01 AAAB,INC. 1105070522AAABUS9147930 21 0008060362Stevenson Craig 540 N.VIA VALVERDE";
int[] j = new int[500];
for (int i = 0, k=0; i < str.Length; i++,k++)
{
j[k] = str.LastIndexOf("AAABUS");
k1 += str.Substring(j[k], (str.Length - j[k]));
if (k % 2 == 1)
{
k1 += "
" ; } str = str.Substring(0, j[k]); } Response.Write(k1); }

No comments :

Post a Comment