Alex Rivera | Logout

How to remove a part of string effectively

Asked 2011-02-17T10:43:10.430
23

Have a string like A=B&C=D&E=F, how to remove C=D part and get the string like A=B&E=F?

Edit
Report

2 Answers

2

I think you need to give a clearer example to make sure it's something for the situation, but something like this should do that:

var testString = "A=B&C=D&E=F"
var stringArray = testString.Split('&');
stringArray.Remove("C=D");
var output = String.Join("&", stringArray);

Something like that should work, and should be pretty dynamic

answered 2011-02-17T10:48:47.510
1

You can either split() and manually join (depending how the data looks like) or simly use string.Replace(,string.empty)

answered 2011-02-17T10:45:39.317

Your Answer