如何从文本框中修剪文本
问题描述:
嗨大家..我怎么能从文本框中修剪字符串例如..我有一个文本你好:sdsdfdsf,我的问题是我想从文本框中分离所有文本开头:从右边开始..但我不认为我能够得到它..再次..我的坏英语家伙... ...
样本输入你好:世界>
示例输出world
hi guys.. how can i trim string from a textbox for example.. i have a text "hello:sdsdfdsf",my problem is i want to seperate all text from the textbox starting from :sign to the right..but i dont think im gonna be able to get it.. again.. sori for my bad english guys..
sample input "hello:world"
sample output"world"
答
我可以在C#中显示它,你可以将它转换为VB,概念是一样的......
I can show this in C# and you can convert it to VB, concept is the same...
string input = "hello:world";
string output = "";
if (input.Contains(":"))
{
output = input.Split(':')[1];
}
或者......
Or...
output = input.Substring(input.IndexOf(':') + 1);
你没有修剪你的文字,你想拆分它。 br $> b $ b
http:// msdn .microsoft.com / zh-cn / library / system.string.split.aspx [ ^ ]
You are not "trimming" your text, you want to Split it.
http://msdn.microsoft.com/en-us/library/system.string.split.aspx[^]