asp.net - compare 2 string to get result different -


i doing method able return me different between data before , data after

dim databefore string = "name:alice,age:30,sex:male" dim dataafter string = "name:alice,age:20,sex:female" mtdcompare2string(databefore,dataafter)     public shared function mtdcompare2string(byval sbefore string, byval safter string) string  //what try before, supposing loop should start on here failed,  //so removed loop, need correct me =(  dim intbefore integer = sbefore.indexof(",") dim intafter integer = safter.indexof(",") dim sbefore string = sbefore.substring(0,intbefore) dim safter string = safter.substring(safter.indexof(":"),intafter)    dim sb stringbuilder sb.append(sbefore,safter)  return sb.tostring       end function 

expected result

age:30>20,sex:male>female

something should work:

public shared function mtdcompare2string(byval sbefore string, byval safter string) string      'what try before, supposing loop should start on here failed,      'so removed loop, need correct me =(      dim before() string = sbefore.split(",")     dim after() string = safter.split(",")     dim returnstring string = ""     = 0 before.length - 1         dim tempbefore string = before(i).split(":")(1)         dim tempafter string = after(i).split(":")(1)         if tempbefore <> tempafter             returnstring += before(i).split(":")(0) + ":" + tempbefore + ">" + tempafter + ","         end if     next     return returnstring.substring(0, returnstring.length - 1) end function 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -