Reputation: 55
I am getting user input on the column, row number and data they want to put in that place. How would I go about breaking the user input into pieces ? The user input will always be in the COLUMN ROW DATA format so is there any delimiter statement that I can use ?
Upvotes: 0
Views: 336
Reputation: 670
If your user input is a string in the format:
<col> <row> <data>
You can use the split() method on the space (" ") to get an array of strings.
For example
input = "3 2 100";
inputs = input.split(" ");
column = inputs[0]; // "3"
row = inputs[1]; // "2"
data = inputs[2]; // "100"
If this isn't what you're looking for then please elaborate your question.
Upvotes: 1