我试图将字符串与int区分开来,并使用scanf()将它们分开。
例如:Ron Burgundy41
是否可以使用 ListBox listBox = new ListBox();
listBox.DataSource = new string[] { "1", "2", "3" };
ToolStripControlHost host = new ToolStripControlHost(listBox)
{
Margin = Padding.Empty,
Padding = Padding.Empty,
AutoSize = false
};
ToolStripDropDown dropDown = new ToolStripDropDown() { AutoClose = false };
dropDown.Items.Add(host);
dropDown.Show();
并获取
name = Ron
last_name =勃艮第
number = 41
答案 0 :(得分:3)
是的,很有可能。你可以这样写scanf
-
if(scanf("%19s %19[^0-9]%d",name,last_name,&number)==3){ //assuming both array of size 20
/* ^ this will read and store in array until a numbers is encountered */
// print them
}