Jump to content

Getting a string from a GUI, and turning it into an Array list


computor

Recommended Posts

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 by computor
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...