![]() |
Urgent in JAVA
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:heeeelll: |
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"); } |
| All times are GMT. The time now is 02:56 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.