Results 1 to 7 of 7

Thread: Array issues

  1. #1
    joka22 is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Default Array issues

    Hi everybody,
    I'm first time on that forum. I have a question.
    Let's say I have an array

    Java Code:
    String[] msgs;
    System.out.println("posx1 = " + msgs[0]);
    System.out.println("posx2 = " + msgs[1]);
    I got the following message:

    MSG(TAG): tagid=10, posx=83, posy=55
    MSG(TAG): tagid=11, posx=22, posy=12

    How can I get just the number for posx and posy from that array? Any idea?

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    So you get two strings there. So what you have to do is, sub string the original one or use regular expression.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default

    Parse the String using indexOf and substring and Integer.parseInt.

    db

  4. #4
    joka22 is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Default

    OK, but what do you mean by regular expression?

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Regular expression is kind of a way that syntactically analyzed elements used to match patterns of text

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

  7. #7
    joka22 is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

Similar Threads

  1. Array traversal issues
    By sondratheloser in forum New To Java
    Replies: 3
    Last Post: 08-13-2012, 12:49 AM
  2. iterator issues
    By orchid in forum New To Java
    Replies: 2
    Last Post: 08-12-2008, 01:43 PM
  3. Issues with Jva I.O
    By Annatar01 in forum New To Java
    Replies: 0
    Last Post: 02-08-2008, 01:16 AM
  4. Array issues
    By Neo82 in forum New To Java
    Replies: 1
    Last Post: 12-31-2007, 03:22 AM
  5. jcheckbox issues need help. thanks.
    By carlos123 in forum New To Java
    Replies: 3
    Last Post: 11-05-2007, 10:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •