|
-
November 3rd, 2005, 05:39 PM
#2
Re: How to loop read thru a text file
 Originally Posted by shawnmandel
I am totally new to Java programming...
I need to be able to do the following:
1) Read the records from a text (TXT) file, the data is in the following format:
Username1, AuthenticationID1
Username2, AuthenticationID2
...
I'll recommend the StreamTokenizer.
2) Present the user with a simple interface to be able to select a specific Username
Creating the user interface in Java is a pain. The sooner you start, the sooner it'll be over.
3) Once a Username is selected, the corresponding AuthenticationID should be captured in a variable; let's assume the AuthenticationID record in the text file is 1234567890 as dictated by the user selecting the associated Username
Maybe you should store the Username and AuthenticationID in a Map or something.
4) Take this variable (i.e. 1234567890) and place it in the AuthenticationID in the following code in my java file (i.e. AuthenticationID is 3981983721 in the JAVA file):
SearchStringTo = CAMID("\3981983721\")
Note: I need the 3981983721 replaced with the one selected from the text file, which is 1234567890, such that the final result would be the modification to the above line in my JAVA file:
SearchStringTo = CAMID("\1234567890\")
SearchStringTo = CAMID(String.format("%1$s", AuthenticationID));
5) Thus, my SearchStringTo variable would now carry the number as selected by the user which originated from the read text file.
Your SearchStringTo variable doesn't carry a number. It's carrying a string. That's an important distinction when determining what to do with the parsed data.
I'm not sure if what I'm asking is easily doable.
I think this is easily doable but your requirements are rather vague.
I know how to build. What to build is a completely different story.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|