How to split a string and assign each word to a new variable?

后端 未结 4 759
野的像风
野的像风 2020-12-21 18:21

I\'m making a credit card processing form. The field in question is Name: (first and last).

What would some C# code look like that would take the text from a text bo

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-21 18:46

    string[] names = txtName.Text.Split(' ');
    string fName = names[0];
    string LName = names[1];
    

提交回复
热议问题