在消息框中的斜杠后显示文本 [英] show text after the slash in messagebox

查看:97
本文介绍了在消息框中的斜杠后显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框,其值类似于Code/10023.实际上,我想要的是在斜杠(/)之后有多少个字母,我想在消息框中显示它..
结果应该像10023.我不知道该怎么做,我尝试使用子字符串,但是我无法实现..

解决方案

IndexOf [ http://www.dotnetperls. com/messagebox-show [ ^ ]

尝试:

 字符串 s = textbox.text;
字符串 []个单词= s.Split(' /' );

MessageBox.Show(words [ 1 ]); 



希望对您有所帮助:)


i have one text box in which value is like Code/10023. Actually What i want is that how many the letters there after the slash(/), i want to show that in messagebox..
Result should be like 10023. I dont know how to do this i was trying using substring but i am not able to achieve this..

解决方案

Substring[^] is Ok. Combine with IndexOf[^] to get the index where to start the substring.


check this http://www.dotnetperls.com/messagebox-show[^]


Try this:

string s =textbox.text;
string[] words = s.Split('/');

MessageBox.Show(words[1]);



hope it helps :)


这篇关于在消息框中的斜杠后显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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