Solved

Java - String Token

Posted on 2006-11-03
1
223 Views
Last Modified: 2010-03-31
Hi!
I have a text file with the following values.

username:password,security question,security answer

Using string token, i do manage to read in username and password via bufferreader.
But my problems comes when reading security question as it is delimited by a "," instead of a ":"

Is there a way during my buffer reader, read in both : and ,?

Else, how am i going to read my security question and answer.

Any solutions would be great.
Cheers!
Darence
0
Comment
Question by:darence
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
marchent earned 30 total points
ID: 17872018
String str = "username:password,security question,security answer";
            StringTokenizer stk = new StringTokenizer(str,":,"); //tokenize by : and ,

~marchent~
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question