Aa, 11, 22
11, 22, aa
String may have the above three forms, I want to remove the aa, keep the format of the 11, 22, specific how to do?
CodePudding user response:
The Replace () function is ok, just have to determine the position of commaCodePudding user response:
String x="11, aa, 22 aa, 11, 22, 22, aa";X=x.R eplace (" aa ", ""). The Replace (" aa", "");
MessageBox. Show (x);
CodePudding user response:
The "aa," and, "aa" can be replaced with an empty string,Strings str1="11,22,22";
String str2=str1. Replace (" aa ", ""). The Replace (" aa", "");
CodePudding user response:
String s="11, aa, 22";The string result=string. Join (", ", s.S plit (', '). The Where (a=& gt; a !="aa"));
CodePudding user response:
According to the first comma separated (Split method), and then will conform to the required data (the Join method) the results