Separating a String into 4 Separate Strings

Posted on 2006-10-27
Medium Priority
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!
Question by:tristatefab
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

Accepted Solution

cpa199 earned 128 total points
ID: 17818130

Assisted Solution

colr__ earned 124 total points
ID: 17818230
String[] splitStrings = custInfo.split(";");

Assisted Solution

valipotor earned 124 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.
LVL 86

Assisted Solution

CEHJ earned 124 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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

765 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