Jump to content

ArrayList to string


Daviyow

Recommended Posts

Hey, my head just exploded. How can i pass this into a string for GroundItem? ex: GroundItem lewt = ("Huge turd", "Flashlight");

    public static ArrayList<String> GUILoot = new ArrayList<String>();

My arraylist outprints this atm:

 

[iNFO ][04/01/14 01:21:22 AM]: GUILoot: [Vial, Herb, Bones]

 

thanks!

 

Edited by daviyow
Link to comment
Share on other sites

  On 3/31/2014 at 11:48 PM, daviyow said:

can i do that in my getState? cus i have some checks for loot in my state or where would be the past part to do this

Wherever you think would be best. Forgot an ArrayList returned the string with brackets though, so you can just pass them in easy and replace the characters you don't want.

GUILoot.toString().replace("[", "").replace("]", "");
Link to comment
Share on other sites

  On 4/1/2014 at 12:49 AM, Swizzbeat said:

 

Wherever you think would be best. Forgot an ArrayList returned the string with brackets though, so you can just pass them in easy and replace the characters you don't want.

GUILoot.toString().replace("[", "").replace("]", "");

eww why #replace twice? ewwwww

String#replaceAll("[\\]\\[]", "")

Link to comment
Share on other sites

  On 4/1/2014 at 12:49 AM, Swizzbeat said:

 

Wherever you think would be best. Forgot an ArrayList returned the string with brackets though, so you can just pass them in easy and replace the characters you don't want.

GUILoot.toString().replace("[", "").replace("]", "");

 

 

Is that ok to place this under dispose(); at GUI?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...