外国人的名字有 first name middle name last name
都是以空格分开的。
第一个页面是用户输入的
Alice goter hu 有时候三个
lina all sphe ton 有时候四个
如何实现点击按钮到另一个页面
变成两个文本框
firstname alice goter
lastname 是最后一个空格后面的 比如 hu 或者ton
怎么判断哪个空格呢?
...全文
25232打赏收藏
截取字符串的又一个问题
外国人的名字有 first name middle name last name 都是以空格分开的。 第一个页面是用户输入的 Alice goter hu 有时候三个 lina all sphe ton 有时候四个 如何实现点击按钮到另一个页面 变成两个文本框 firstname alice goter lastname 是最后一个空格后面的 比如 hu 或者ton 怎么判断哪个空格呢?
[Quote=引用 6 楼 pei2lala 的回复:]
string str = "first name middle name last name";
int index = str.LastIndexOf(" ");
txt1.Text = str.Substring(0,index);
txt2.Text = str.Substring(index+1);
[Quote=引用 6 楼 pei2lala 的回复:]
string str = "first name middle name last name";
int index = str.LastIndexOf(" ");
txt1.Text = str.Substring(0,index);
txt2.Text = str.Substring(index+1);
string str = "first name middle name last name";
int index = str.LastIndexOf(" ");
txt1.Text = str.Substring(0,index);
txt2.Text = str.Substring(index+1);
[Quote=引用 6 楼 pei2lala 的回复:]
string str = "first name middle name last name";
int index = str.LastIndexOf(" ");
txt1.Text = str.Substring(0,index);
txt2.Text = str.Substring(index+1);
[Quote=引用 6 楼 pei2lala 的回复:]
string str = "first name middle name last name";
int index = str.LastIndexOf(" ");
txt1.Text = str.Substring(0,index);
txt2.Text = str.Substring(index+1);
string str = "first name middle name last name";
int index = str.LastIndexOf(" ");
txt1.Text = str.Substring(0,index);
txt2.Text = str.Substring(index+1);
[Quote=引用 6 楼 pei2lala 的回复:]
string str = "first name middle name last name";
int index = str.LastIndexOf(" ");
txt1.Text = str.Substring(0,index);
txt2.Text = str.Substring(index+1);