Results 1 to 5 of 5
  1. #1
    skatefreak is offline Member
    Join Date
    Jan 2009
    Posts
    18
    Rep Power
    0

    Default how to wrtite " " "

    Hey,
    Simple question here,
    I need to write a string through a loop that pulls out the user names from a database and this string will be used to populate a drop down menu.

    The only problem is i cannot figure out how to write the " character in the string and without this the string cannot be used to populate the drop down menu.

    The exact line concerned is
    Java Code:
    users = users + " " " + s + " ", "
    The desired output is
    "chris","vasilis",
    etc.

    Best regards and thanks for you time!

    -Chris Jvr

  2. #2
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    7

    Default

    Is it giving you an error? That line seems fine to me. the only thing I can think of is quotation marks are special case characters and need something like \" to display them.
    Liberty has never come from the government.
    Liberty has always come from the subjects of government.
    The history of liberty is the history of resistance.
    The history of liberty is a history of the limitation of governmental power, not the increase of it.

  3. #3
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    7

    Default

    Correct.
    Java Code:
    String name1 = "Kris";
    String name2 = "Rory";
    System.out.println(" \" "+name1+" \", \" "+name2+" \" ");
    gave an output of "Kris", "Rory"
    Liberty has never come from the government.
    Liberty has always come from the subjects of government.
    The history of liberty is the history of resistance.
    The history of liberty is a history of the limitation of governmental power, not the increase of it.

  4. #4
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    7

    Default

    definitely need to escape the quotation marks you want displayed as already suggested

  5. #5
    skatefreak is offline Member
    Join Date
    Jan 2009
    Posts
    18
    Rep Power
    0

    Default

    Hey there,
    very much appreciated, worked a charm for the output, only now java doesnt like the input this output is being used for heh...
    What a barrel of laughs.
    Thankyou very much though for the input though people! Much appreciated! :)

    -Jvr

Similar Threads

  1. Java, Military Format using "/" and "%" Operator!!
    By sk8rsam77 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 04:03 AM
  2. Replies: 2
    Last Post: 01-24-2009, 07:56 PM
  3. Replies: 1
    Last Post: 10-20-2008, 08:35 AM
  4. <core:forEach var="" begin="+<%=j%>+">???
    By freddieMaize in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 09-27-2008, 02:20 AM
  5. "Jumble" or "Scramble" Program
    By Shadow22202 in forum Java Applets
    Replies: 8
    Last Post: 04-30-2008, 04:42 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
  •