Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Split String and for loop issues. (Beginner problems)

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Split String and for loop issues. (Beginner problems)

    Well Im trying to get the string called URL to be split at the & and = signs but im running into a few errors using tokens. Its a simple code but the tokens keep saying its unresolved. my code:

    public class URL {
    public static void main(String[] args) {
    String URL = "NAME=Greg&EMAIL=G@email.edu&SSNO=12345678&PREVCOU RSES=Math+110&REASON=To+learn+programming&Special+ Interests=robots";
    String() token = URL.split("&");

    for (String t ; ta)
    (
    String() A= t.split("=");
    for (String h ; A);
    System.out.println(URL);


    }
    }


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,156
    My Mood
    Hungover
    Thanks
    141
    Thanked 595 Times in 510 Posts

    Default Re: Split String and for loop issues. (Beginner problems)

    What is the actual error? Check your syntax, you've got quite a few errors here.

    Also, please use the highlight tags when posting code.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    8
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Split String and for loop issues. (Beginner problems)

    Are you writing this code in some IDE like Netbeans /Eclipse ?and at what point you are getting the error i mean is it runtime or compile time,

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,156
    My Mood
    Hungover
    Thanks
    141
    Thanked 595 Times in 510 Posts

    Default Re: Split String and for loop issues. (Beginner problems)

    There are definitely compile-time errors. The syntax is way off, and that needs to be fixed before we proceed.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Replies: 3
    Last Post: October 26th, 2012, 02:19 PM
  2. Basic while loop issues
    By Litost in forum Loops & Control Statements
    Replies: 1
    Last Post: October 8th, 2012, 07:15 AM
  3. NEED HELP! Beginner JApplet Problems
    By bam0792 in forum AWT / Java Swing
    Replies: 4
    Last Post: February 20th, 2012, 01:52 PM
  4. String.split("") puts null in the first index
    By sonicjr in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 17th, 2012, 03:25 AM
  5. (Beginner/Intermediate) Tic Tac Toe game issues
    By Sylentwolf8 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 17th, 2012, 07:03 AM