Jump to content

getting an array of numbers from a text field

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
strowa65

strowa65

    Newbie

  • Members
  • Pip
  • 4 posts
How do u get a string from the text field and convert it to an array of integers?

and how do u display a 2D array in a text area with the proper alignment and spaces?

#2
strowa65

strowa65

    Newbie

  • Members
  • Pip
  • 4 posts
I have another doubt...how do u reverse a string in java?

#3
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
You can use the string-function, reverse.

#4
gszauer

gszauer

    Programmer

  • Members
  • PipPipPipPip
  • 113 posts
Create a temporary string.
Break up your string by delimiter.
Each time you break a chunk off the begining, assign it as the value of the temporary string.
Use the Integer.parseInt() method to convert the string to an integer, and assign the returned value into your array.

Need some code, or was the above enough to explain?

~Aristotle said:

It is the mark of an educated mind to entertain a tought without accepting it
If my post was helpful, please help me build some rep Posted Image