如何在C#中删除文本框中的最后一个字符串 [英] how to remove last strings in textbox in C#

查看:264
本文介绍了如何在C#中删除文本框中的最后一个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 如何删除文本框中的最后一个字符串.


如果我的搜索条件是.net和asp.net以及and和and ....
然后我要删除最后一个字符串(即仅last和"s").
所以如何删除文本框中的最后一个字符串

Hi how to remove last strings in textbox.


if my search criteria is like .net and asp.net and and and and....
then i want to remove last strings(i.e last and''s only).
so how to remove last strings in textbox

推荐答案

使用子字符串

在网上搜索


Use Substring

search on net


string s = ".net and asp.net";
string output = s.Replace("and", "");



请尝试 String.TrimEnd

Hi,
Please try String.TrimEnd

string s = @".net and asp.net and" ;
string output = s.TrimEnd("and");


使用正则表达式字符串: and
Use regular expression string: and


这篇关于如何在C#中删除文本框中的最后一个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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