Sorting String by ASCII Values

  • Share this:

Code introduction


This function takes a string as input and returns a new string with characters sorted in ascending order based on their ASCII values.


Technology Stack : String, Sorting

Code Type : String processing

Code Difficulty : Beginner


                
                    
def a_to_z_sequence(s):
    return ''.join(sorted(s, key=lambda x: ord(x)))                
              
Tags: