Sunday, 18 August 2013

Remove all duplicate characters in a string?

Remove all duplicate characters in a string?

Say I have the following:
$str = "1AAABBCCCDDDDDDD";
How can I remove all the duplicate characters in the string? So it would
look like this?
$result = "1ABCD";

No comments:

Post a Comment