1
Answer

How to split and replace in VB.NET

Rajkumar R

Rajkumar R

12y
1.3k
1
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 splited this and to stored in an array variable. for that i tried the following. Because here i want to replace occupation="farmer" this one array position alone alone.
and finally i want to concatenate all the array indexes and stored in the vXMLStream  variable. 
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"
sex="Male" 
category="Poor" 
edu_qualification="BBA" 
community="SC" 
religion="HINDU" 
occupation="farmer"
Here i want to replace this (occupation="farmer"  this is static one) finally i want to concatenate all the array indexes and stored in the vXMLStream  variable. 
please post solution for this post



Answers (1)