字符串到数组 [英] String to an array

查看:106
本文介绍了字符串到数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于一个项目,我需要从用户要输入的文本框中获取一串数字并将输入的数字字符串分配给一个数组,我需要对两个单独的数组和文本框执行此操作.然后,我需要能够添加和减去数组. 我什至不知道从哪里开始.我只声明了变量,对您的帮助将不胜感激!

For a project I need to take a string of numbers from a textbox that the user will input and assign the string of inputted numbers to an array, I need to do this for two separate arrays and textboxes. Then I need to be able to add and subtract the arrays. I'm not even sure where to begin. I've only declared my variables, any help would be greatly appreciated!

推荐答案

对于一个项目,我需要从文本框中获取一串数字,用户将输入输入数字的字符串并将其分配给数组,我需要对两个单独的数组和文本框执行此操作.然后我需要能够加减 数组.我什至不知道从哪里开始.我只声明了我的变量,将不胜感激!
For a project I need to take a string of numbers from a textbox that the user will input and assign the string of inputted numbers to an array, I need to do this for two separate arrays and textboxes. Then I need to be able to add and subtract the arrays. I'm not even sure where to begin. I've only declared my variables, any help would be greatly appreciated!

用户是否将所有数字作为一个字符串输入到文本框中?如果是这样,则需要指定字符串的格式,以便可以制定一个规则,使每个数字都可以分开.

Is the user is inputting all the numbers into the text box as one string?  If so, you need to specify the format of the string so that a rule can be set out which enables the string to be split apart for each number.

如果您的用户要一次输入一个数字,那么您需要指出用户界面的工作方式.例如,他们会输入数字,然后按确定按钮吗?他们将如何表明他们已经完成 输入数字?

If your user is going to be entering the numbers one at a time, then you need to indicate how the user interface is going to work.  For instance, will they enter a number and then press a OK button?  How will they indicate that they have finished entering numbers?

通常,如果您花时间详细编写任务,考虑到过程中的每个微小步骤,代码中的解决方案就会变得更加清晰.

Generally, if you take the time to write out the task in detail, considering every single tiny step of the process, the solution in code becomes much clearer.


这篇关于字符串到数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆