Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


I have a string like _a01_a02_a03_ and another string like
_2_1.5_4_ as input.I want to extract a01,a02... to a string
array and 2,1.5,etc to a double array with a01 corresponds
to 2 and a02 to 1.5 etc. Need code in core java.. Can you do
it?



I have a string like _a01_a02_a03_ and another string like _2_1.5_4_ as input.I want to extract a0..

Answer / sam

final String str1 = "_a01_a02_a03";
final String str2 = "_2_1.5_4";
final String[][] strArray = new String[3]
[2];
final StringTokenizer objST1 = new
StringTokenizer(str1,"_");
final StringTokenizer objST2 = new
StringTokenizer(str2,"_");
int iCnt=0;
while (objST1.hasMoreTokens())
{
objST2.hasMoreTokens();
strArray[iCnt][0] = (String)
objST1.nextToken();
strArray[iCnt++][1] = (String)
objST2.nextToken();
}
for(iCnt=0;iCnt<3;)
System.out.println(strArray[iCnt][0]
+" "+strArray[iCnt++][1]);

Is This Answer Correct ?    17 Yes 0 No

Post New Answer

More Core Java Interview Questions

Which class is the superclass for every class in java programming?

0 Answers  


Why super is first line in java?

0 Answers  


What is json parser in java?

0 Answers  


What is the importance of finally block in exception handling?

0 Answers  


What are streams?

0 Answers  


Which methods cannot be overridden in java?

0 Answers  


what is the need of the Ajax?

5 Answers   iFlex,


What is singleton service?

0 Answers  


Can you run java program without main method?

0 Answers  


What is the difference between jsp and servlet?

6 Answers   Symphony,


What is the generic class?

0 Answers  


How will you reverse a singly-link list?

0 Answers   Akamai Technologies,


Categories