Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Lorenzo Lee   on Dec 09 In Asp.net Category.

  
Question Answered By: Miriam Green   on Dec 09


using System.Text.RegularExpressions;



Regex r = new Regex("(,)"); // Split on hyphens.

string[] s = r.Split("abc,def,ghi,jklm,no,pq,rstuvw,xyz");

string[] s2 = new string[(int)Math.Round((decimal)s.Length/(decimal)2)]; // you
might have to add a 1 to the length, or you might
//as well add it anyway ...it can't hurt

for (int i =0; i<s.Length;i++)

{

if (i % 2 == 0)

s2[i/2] = s[i];

}

for (int i =0; i<s2.Length;i++)

{

Response.Write(s2[i] + "<br>");

}


Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Getting Individual String Or get search suggestion and latest updates.


Tagged: