Given a string str which represents the ASCII Sentence, the task is to convert this string into its equivalent character sequence.
Input: str = “71101101107115”
71, 101, 101, 107 are 115 are the unicode values
of the characters ‘G’, ‘e’, ‘e’, ‘k’ and ‘s’ respectively.
Input: str = “104101108108111443211911111410810033”
Output: hello, world!
Approach: Traverse the complete string character by character and concatenate every digit. Once the value of the concatenation comes in the range [32, 122] we print the character value corresponding to this numeric value in the ASCII table. We are taking the range [32, 122] because spaces, uppercase letters, lowercase letters are within this range.
Below is the implementation of the above approach:
Time Complexity: O(N) where N is the length of the given string.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Print given sentence into its equivalent ASCII form
- Convert a sentence into its equivalent mobile numeric keypad sequence
- Convert a string to hexadecimal ASCII values
- Convert Hexadecimal value String to ASCII value String
- Sums of ASCII values of each word in a sentence
- Print each word in a sentence with their corresponding average of ASCII values
- Convert the given BCD to its equivalent Binary form
- Program to convert Hexa-Decimal Number to its equivalent BCD
- Convert all lowercase characters to uppercase whose ASCII value is co-prime with k
- Decode an Encoded Base 64 String to ASCII String
- Check whether the binary equivalent of a number ends with given string or not
- Average of ASCII values of characters of a given string
- Program to find the XOR of ASCII values of characters in a string
- Count pairs of characters in a string whose ASCII value difference is K
- Count characters in a string whose ASCII values are prime
- Check if a string contains only alphabets in Java using ASCII values
- Split a given string into substrings of length K with equal sum of ASCII values
- Program to find the product of ASCII values of characters in a string
- Longest string in non-decreasing order of ASCII code and in arithmetic progression
- Program to find the largest and smallest ASCII valued characters in a 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 firstname.lastname@example.org. 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.