We have string str and we need to find the string with all unique characters from the given string. All different characters should be printed in ascending order.
Input : $str = "GeeksforGeeks" Output : Gefkors Explanation, the unique characters in the given string $str in ascending order are G, e, f, k, o, r and s Input : $str = "Computer Science Portal" Output : CPSaceilmnoprtu Explanation, the unique characters in the given string $str are C, P, S, a, c, ei, l, m, n, o, p, r, t and u
The problem can be solved using PHP in built function for collecting all the unique characters used in the given string.The in built function used for the given problem is:
- count_chars():The in built function has parameter which contains return mode an integer type which are as such 0, 1, 2, 3, 4 in which return mode 3 returns the string of all different characters used in the given string in ascending order.
Note: The string is case-sensitive.
- Python | Check if frequencies of all characters of a string are different
- Replace minimal number of characters to make all characters pair wise distinct
- How to get the last n characters of a PHP string?
- How to remove all non-printable characters in a string in PHP?
- How to remove control characters from PHP string ?
- How to find number of characters in a string in PHP ?
- Check whether second string can be formed from characters of first string
- How to move a file into a different folder on the server using PHP?
- How to check a string begins with some given characters/pattern ?
- Count of 1-bit and 2-bit characters in the given binary string
- Maximum repeated frequency of characters in a given string
- PHP | Check if all characters are lower case
- How to remove non-alphanumeric characters in PHP?
- Convert List of Characters to String in Java
- Remove characters from string that appears strictly less than K times
- Python program to check if a string contains all unique characters
- Iterate over characters of a string in Python
- Add index to characters and reverse the string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.