How-to articles, tricks, and solutions about ASCII

Convert character to ASCII numeric value in java

To convert a character to its ASCII numeric value in Java, you can use the charAt method of the String class and the intValue method of the Character class.

How to convert ASCII code (0-255) to its corresponding character?

To convert an ASCII code (0-255) to its corresponding character in Java, you can use the char data type and cast the ASCII code to it.

How to get the ASCII value of a character

To get the ASCII value of a character in Python, you can use the built-in ord() function.

How to remove all non printable characters in a string?

To remove all non-printable characters in a string in PHP, you can use the preg_replace function with a regular expression pattern that matches non-printable characters.

Reading a plain text file in Java

This code opens the file "filename.txt" and reads it line by line. Each line is printed to the console until the end of the file is reached.