开发者

split the message into array

RadikalGenc.aspx?phonenumber=5552451245&message=ISTAN-ALL-123;Emly,Foz,Praia,Sol,Luna,Trabalha

string number = Request.QueryString["phonenumber"].ToString();
string textMessage = Request.QueryString["message"].ToString();

I need the textMessage splitted int array Like this:

ISTAN-AL开发者_运维技巧L-123 -> Presents Form name The list below, presents the fiels name

  1. Emly
  2. Foz
  3. Praia
  4. Sol
  5. Luna
  6. Trabalha

how can do that?


Try this (assuming that you're sure that will always be the format and that none of the values will ever contain one of the separators (; or ,):

textMessage.Split(';')[1].Split(',')


You can split the message variable two times. The first time by ISTAN-ALL-123; which will get you Emly,Foz,Praia,Sol,Luna,Trabalha and then perform another split by ','

String.Split


Something like this

string[] messageArray = Request.QueryString["message"].Split(';');
string formName = messageArray[0];
string[] fieldArray = messageArray[1].Split(',');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜