Urgent in JAVA

Discussion in 'Software' started by gaurav_kant, Sep 28, 2007.

  1. gaurav_kant

    gaurav_kant

    Joined:
    Sep 26, 2007
    Messages:
    10
    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);
    }

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

    String str = st;
    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:
     
    gaurav_kant, Sep 28, 2007
    #1
    1. Advertising

  2. gaurav_kant

    brishu

    Joined:
    Nov 8, 2007
    Messages:
    3
    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);
    }

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

    String str = st;
    String tmp[]= str.split("@");
    for (int j = 1; j < tmp.length; j++) {
    System.out.print (tmp[j]);
    }
    System.out.print ("\n");
    }
     
    brishu, Nov 8, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. siti maz
    Replies:
    0
    Views:
    1,108
    siti maz
    Oct 13, 2006
  2. siti maz
    Replies:
    0
    Views:
    1,261
    siti maz
    Oct 13, 2006
  3. Security Advisory

    !!URGENT!! Tor Vulnerability Discovered !!URGENT!!

    Security Advisory, Aug 6, 2007, in forum: Computer Security
    Replies:
    1
    Views:
    976
    http://tinyurl.com/23k3dt@$NIFF-deeply.ahh
    Aug 11, 2007
  4. pooja
    Replies:
    0
    Views:
    1,200
    pooja
    Mar 3, 2009
  5. Griffin
    Replies:
    0
    Views:
    645
    Griffin
    Aug 27, 2010
Loading...

Share This Page