A
ad
I have a string like "1,2,2,3,3,3,4"
I want to trim off the duplicate part, and make it to "1,2,3,4"
How can I do?
I want to trim off the duplicate part, and make it to "1,2,3,4"
How can I do?
ad said:I have a string like "1,2,2,3,3,3,4"
I want to trim off the duplicate part, and make it to "1,2,3,4"
How can I do?
Try with this snippetad said:I have a string like "1,2,2,3,3,3,4"
I want to trim off the duplicate part, and make it to "1,2,3,4"
How can I do?
Try with this snippet
string nstr = "";
for (int i = 1;i< str.Length;i++)
{
if (str != str[i-1])
nstr += str;
}
I'd probably go with a mix of better ideas from the above
- use Split to parse the input string
- use StringBuilder to generate the new string
ad said:Could you check it when usr input with TextBox by a
RegularExrpessionValidation?
I'd probably go with a mix of better ideas from the above
- use Split to parse the input string
- use StringBuilder to generate the new string
I said:I'd suggest the following (uncommented, for the sake of briefness)
solution instead.