wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes How to display all of the ascii characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to display all of the ascii characters" Watch "How to display all of the ascii characters" New topic
Author

How to display all of the ascii characters

Jeff Ciaccio
Greenhorn

Joined: Nov 26, 2008
Posts: 25
I am trying to write a little code to display all of the ascii characters, but it doesn't seem to like to concatenate the backslash with an int. Any ideas on how to get this to work?

Thanks!!



Jeff Ciaccio, Java novice <br />Physics and AP Physics Teacher<br />Sprayberry High School <br />Marietta, GA
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37953
    
  22
The escape characters for \123 are in octal. Try 0400 instead of 400. Some of them are control characters, which don't print. Two are line end characters, so you only see a line break.
And it's "\\" not "\".
Make sure to print \007 several times
Jeff Ciaccio
Greenhorn

Joined: Nov 26, 2008
Posts: 25
When I make it "\\", I only get the following:
1: \1
2: \2
3: \3
4: \4
5: \5
6: \6
7: \7

But I want to see the characters for each. I don't want to have to put in "\1" "\2" etc so I am trying to get a loop to do this for me.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

How about simply casting it to char?
Also, ASCII ends at 127. Everything beyond that is no longer ASCII.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
Don't get me started about those stupid light bulbs.
 
subject: How to display all of the ascii characters
 
Similar Threads
problem in System.out.write
Help correcting a button behavior in swing
Dsplaying the alphabet with a loop?
Printing Special Characters, TAB, CR, etc
Using grep in less output