如何从文本框中修剪文本 [英] how to trim text from a textbox

查看:90
本文介绍了如何从文本框中修剪文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家..我怎么能从文本框中修剪字符串例如..我有一个文本你好: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[^]


这篇关于如何从文本框中修剪文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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