i have two string and one array of string.
let the str1, str2, strArr
here
str1="1";
strArr elements are {2,5,7}
str2="1,3,4,5,6,1,3,7,2,1,5,6";
now i want remove those char from str2 which are present in strArr, and str1
Note: str1 will always have 1 char, but strArr can have any number of elements.
Member
150 Points
175 Posts
how to remove character from strings
Jul 23, 2014 02:11 PM|amit_ask|LINK
i have two string and one array of string.
let the str1, str2, strArr
here
str1="1";
strArr elements are {2,5,7}
str2="1,3,4,5,6,1,3,7,2,1,5,6";
now i want remove those char from str2 which are present in strArr, and str1
Note: str1 will always have 1 char, but strArr can have any number of elements.
All-Star
101931 Points
20703 Posts
Re: how to remove character from strings
Jul 23, 2014 02:21 PM|MetalAsp.Net|LINK
Add str1 to strArr and then use LINQ Except() on str2 & strArr. Easy and simple.
Refer: http://msdn.microsoft.com/en-us/library/vstudio/bb300779(v=vs.100).aspx
Edit: corrected str1 to strArr.
All-Star
114593 Points
18503 Posts
MVP
Re: how to remove character from strings
Jul 23, 2014 02:55 PM|Rion Williams|LINK
There are quite a few ways to handle this, however you would likely want to use the following :
You can see a working example below :