【发布时间】:2015-02-07 04:22:57
【问题描述】:
在主要目标中,我需要通过删除逗号 , 将输入从 ("5,23,12,23...") 更改为 ("5 23 12 ... ")。
我已经删除了这个逗号,但是下一个对象是从这个输入数字中找到最小值和最大值。我不知道如何将array<string> 解析为array<int> 来做下一个目标。
我不能这样做number[word]=Convert::ToInt32(words[word]); 所以请有人告诉我如何解决这个问题。
String^ strInput="";
String^ strResult="";
String^ strRemove=",";
array<Char>^Remove=strRemove->ToCharArray();
array<String^>^words;
array<Int32^>^number;
int test;
//get text from input ui
strInput=txtInput->Text;
words=strInput->Split(Remove);
for(int word=0;word<words->Length;word++)
{
/*number[word]=Convert::ToInt32(words[word]);*/
test=Int32::Parse(words[word]);
txtResult->Text+=words[word]+" ";
}
【问题讨论】:
-
这不是 C++。可能是 C++/CLI。
标签: c++ arrays string winforms int