• Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting Letters to Ascii  RSS feed

 
Takumi Fujiwara
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read the thread a couple lines down, but that did not help me (at least I don't think it did...). I'm reading in from a file, and when it sees a letter between A-Z, it stores the value that comes with the letter into an array of length 26. I'm confused how to correspond A with position 0 and so forth.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that char are a numeric type, so you can perform math on them. E.g.
 
Takumi Fujiwara
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I'm still having some trouble with this. What's suppose to happen is the program reads in strings from a file and tokenizes them via StringTokenizer. Then within the file read in, there will be variables between A-Z. Those variables need to be read in and changed to ints so that they can correspond with an array.



As you can see, there are various mistakes. I'm having trouble changing the variables A-Z to ints, and then giving them a position in the array letters. IE: A = 0, B = 1... Z = 25.

Edit: Disregard this. I figured it out. But I'll leave it if people get bored and wish to debug that or something.
[ May 22, 2004: Message edited by: Takumi Fujiwara ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!