| Author |
Help Reading and storing characters
|
jose santelices
Greenhorn
Joined: Feb 02, 2010
Posts: 4
|
|
How can i Read a Word that is declared as String and then divide the word and store each character in a variable
Right now Im writing a program that reads a line like this one: HDSL841216CLDNO895
What I want its to store each character in that line in a different variable, I'm trying to get into array but cannot figure out the codem I had tryied as String Split but also I dont know how to store each character in a different variable, Does any body can help me?
What im trying to do exactly is read that line that is in a TextField and then Print a birthday based on the first 4 numbers in the line(year,month,day). I only need the instructions on how to read and store each character in a different variable as I've been trying all day, its driving me crazy
Regards to everybody
here is a little code i have so far but its like nothing i really got nothing im blind with this xD
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8439
|
|
Jose,
Welcome to the Ranch.
Check out the String#toCharArray and String#charAt and String#length methods.
Now can you think of any why to use a combination of these to extract the first 4 characters in your string?
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
 |
|
|
subject: Help Reading and storing characters
|
|
|