Results 1 to 5 of 5
  1. #1
    java1's Avatar
    java1 is offline Member
    Join Date
    Mar 2011
    Location
    USA
    Posts
    9
    Rep Power
    0

    Default String divided issue

    i have string

    $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,1 91194,020.3,E*68

    I need to divided it with
    $GPRMC
    225446
    A

    look like this


    without split
    Last edited by java1; 01-28-2012 at 12:24 PM.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: String divided issue

    without split
    Look at the String class's methods to find the delimiters and create the substrings
    or the StringTokenizer class.

  3. #3
    java1's Avatar
    java1 is offline Member
    Join Date
    Mar 2011
    Location
    USA
    Posts
    9
    Rep Power
    0

    Default Re: String divided issue

    Quote Originally Posted by Norm View Post
    Look at the String class's methods to find the delimiters and create the substrings
    or the StringTokenizer class.



    import java.util.StringTokenizer;

    public class StringTokenizerEx {

    /**
    * @param args
    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub


    String str="$GPRMC,225446,A,4916.45,N,12311.12,W,000.5,05 4.7,191194,020.3,E*68";



    System.out.println("----------Split by Cimma ------------------- ");
    StringTokenizer st2=new StringTokenizer(str, ",");
    while(st2.hasMoreElements()){
    System.out.println(st2.nextElement());

    }


    }

    }

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: String divided issue

    Have you solved your problem?

  5. #5
    java1's Avatar
    java1 is offline Member
    Join Date
    Mar 2011
    Location
    USA
    Posts
    9
    Rep Power
    0

    Default Re: String divided issue

    Quote Originally Posted by Norm View Post
    Have you solved your problem?
    yea i have solved my problem

    thanks for your time

Similar Threads

  1. String to date conversion issue...
    By nikhil.navadiya in forum New To Java
    Replies: 5
    Last Post: 12-21-2011, 12:28 PM
  2. String object comparison issue
    By subith86 in forum New To Java
    Replies: 3
    Last Post: 01-19-2011, 07:18 AM
  3. Issue with String tokenizer..
    By jainanuj82 in forum Advanced Java
    Replies: 6
    Last Post: 06-24-2010, 02:19 PM
  4. [SOLVED] String Length issue.
    By ChrisMayhew in forum New To Java
    Replies: 7
    Last Post: 01-11-2009, 04:16 AM
  5. Help with a word, if it is divided by spaces
    By baltimore in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 07:31 AM

Posting Permissions

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