Solved

Separating a String into 4 Separate Strings

Posted on 2006-10-27
6
195 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
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

837 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