| Author |
working with Strings
|
gayathriy Nandakumar
Greenhorn
Joined: Jul 11, 2006
Posts: 15
|
|
Hi ..i am working with Strings and i have a requirement where i have to create a unique number for each string entered without the help of built-in functions and i have one more question...how do i get the ascii number for each character in a string?? thanks
|
 |
Rusty Shackleford
Ranch Hand
Joined: Jan 03, 2006
Posts: 490
|
|
|
use charAt() to access each char, which is an integral value.
|
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
Java doesn't use ASCII, it uses Unicode; but for your purposes, Unicode is a superset of ASCII. In Java, as in C and many other similar language, a character is an integral type; it is it's own "ASCII code". You can just cast a char to an int, although even that isn't needed most of the time: int asciiCode = (int) myChar;
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: working with Strings
|
|
|