Click here to Skip to main content
15,897,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have an arugument like this
vXMLStream = YYYYMM="200502" ename="RAJ" age="23" sex="Male" category="Poor" edu_qualification="BBA" community="SC" religion="HINDU" occupation="farmer" month_income="2000"

here i want to split this and to store in an array variable. for that i tried the following.
VB
Dim sourceString As String = vXMLStream
Dim arrayOfStrings() As String = sourceString.Split(" ")
System.Web.HttpContext.Current.Response.Write("<script language='javascript'>alert('The following errors have occurred:\n" + arrayOfStrings(2) + "' );</script>")

But Now once i print the data i am getting output like this
YYYYMM="200502"
ename="RAJ"
age="23"

But i want to o show like this
200502
RAJ
23
Male
Poor

please post solution for this post
Posted
Updated 21-Feb-12 23:58pm
v2

Try

VB
Dim arrayOfStrings() As String = sourceString.Split(New [Char]() {" "c,"="c})
 
Share this answer
 
Comments
rajrprk 22-Feb-12 6:13am    
arrayOfStrings(1) for this i am getting YYYYMM. But i want the value ie.,200502. Here YYYYMM, ename,gae,sex all are field name i want the value of the field.
CRDave1988 22-Feb-12 6:54am    
yes but in arrayOfStrings(2) u will get 200502 so loop according to that. ur problem does not have one line solution.
rajrprk 22-Feb-12 7:14am    
Thanks a lot
VB
Dim arrayOfStrings() As String = sourceString.Split(New [Char]() {" "c,"="c})


U can use the above code but u need to print the alternate indexes like below

C#
for (int i = 0; i < arrayOfStrings.Length; i=i+2)
{
//
//
}
 
Share this answer
 
Now, run a loop on array and again split and last index value put in separate array. When loop will be end after that print value from output array.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900