Solved

Separating a String into 4 Separate Strings

Posted on 2006-10-27
6
199 Views
Last Modified: 2010-03-31
I have the following String...

String custInfo = "Timothy Woods; Toys'R'Us; 12345; 101 Victory Street, Columbus, Ohio 43230";

Can this be done in a quicker way than just declaring 4 Strings separately?

Thanks Everyone!
0
Comment
Question by:tristatefab
[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
6 Comments
 
LVL 1

Accepted Solution

by:
cpa199 earned 32 total points
ID: 17818130
0
 
LVL 8

Assisted Solution

by:colr__
colr__ earned 31 total points
ID: 17818230
String[] splitStrings = custInfo.split(";");
0
 
LVL 6

Assisted Solution

by:valipotor
valipotor earned 31 total points
ID: 17818405
>>> Can this be done in a quicker way than just declaring 4 Strings separately?

As for execution time, declaring them as 4 separate strings it the fastest of them all.
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 31 total points
ID: 17818844
String[] custInfoAr = { "Timothy Woods", "Toys'R'Us",  "12345", "101 Victory Street",  "Columbus", "Ohio",  "43230" };

CustomerInfo ci = new CustomerInfo(custInfoAr); // make your own class for tis
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

734 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