computor Posted December 15, 2014 Posted December 15, 2014 (edited) I have made a GUI, and I want to take whatever is in the textbox, and turn it in to an array, separated by every new line. Example: In the textbox you would put a variety of items: Lobster Fire rune Bones Coins and then have every single one of those items be the next value in an array. So value 0 in the array would be "Lobster", value 1 would be "Fire rune", and so on. However, I'm running in to a problem where I can only take the ENTIRE string from the textbox. At that point the string has been trimmed (only the indents have been removed). Is there a way to make this happen?? I'm trying to use the split function somehow, but I don't quite get how to put the splitted items into an array, or how to split after every new line. item.split("/n"); does this work??? Edited December 15, 2014 by computor
computor Posted December 15, 2014 Author Posted December 15, 2014 PROBLEM SOLVED ON MY OWN. SOLUTION: public String[] temp; temp = itemsToPickUp.getText().split("\n");