Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > Urgent in JAVA

Reply
Thread Tools

Urgent in JAVA

 
 
gaurav_kant gaurav_kant is offline
Junior Member
Join Date: Sep 2007
Posts: 12
 
      09-28-2007
i have to tokanoze a string

String longString = "name|manish|kumar|malkoti,company|Nucles|Software |EPL,profession|Senior|Programmer";

in this format

name = manishkumar malkoti
company=nucleussoftwareEPL
profession=SeniorProgrammer


my logic is :

String st[] = longString.split(",");
for (int i = 0; i < st.length; i++) {
System.out.println(st[i]);
}

for (int i = 0; i < st.length; i++) {

String str = st[i];
String tmp[]= str.split("|");
for (int j = 1; j < tmp.length; j++) {
System.out.println(tmp[j]);
}
break;


}



but its out put is :

name|manish|kumar|malkoti
company|Nucles|Software|EPL
profession|Senior|Programmer
n
a
m
e
|
m
a
n
i
s
h
|
k
u
m
a
r
|
m
a
l
k
o
t
i


please help
 
Reply With Quote
 
 
 
 
brishu brishu is offline
Junior Member
Join Date: Nov 2007
Posts: 3
 
      11-08-2007
dude try this code ... this gives you what you want ... it doesn't look that good ... but i think sumthin in Java makes it so that you cant replace ("|")s i tried and it gives you what you want .... if there are 2 many spaces then you can Just delete the space infront of the string;





String longString = "@ name = manish @ kumar @ malkoti,@ company = Nucles @ Software @ EPL,@ profession = Senior @ Programmer";

String st[] = longString.split(",");
for (int i = 0; i < st.length; i++) {
System.out.println(st[i]);
}

for (int i = 0; i < st.length; i++) {

String str = st[i];
String tmp[]= str.split("@");
for (int j = 1; j < tmp.length; j++) {
System.out.print (tmp[j]);
}
System.out.print ("\n");
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT RichA <rander3127@gmail.com> For rec.photo.digital MVP of all time. Vote now!! URGENT. Griffin Digital Photography 0 08-27-2010 08:18 AM
urgent help....need urgent help on say string task.. pooja Software 0 03-03-2009 06:16 AM
!!URGENT!! Tor Vulnerability Discovered !!URGENT!! Security Advisory Computer Security 1 08-11-2007 09:04 PM
URGENT !! QUEUE STL PROBLEM URGENT!! Sachin Jagtap C++ 4 04-29-2005 12:08 PM
Urgent problem, repeat, Urgent problem. Rob Javascript 3 05-18-2004 12:05 AM



Advertisments