如何从一个字符串中删除一个字符串 [英] How to remove a string from a string

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

问题描述

我添加一个字符串(一)和(b)之前,我将它存储在数据库中,当我从数据库取回的价值,我想删除从字符串()将字符串(b)另一串。串(b)是一个常数。我该怎么办呢

 字符串=text1中; 
字符串B =文本2;
串c = A + B;



我想后,我从数据库


retrive它从C删除b
解决方案

  C = c.Replace(二,); 



是一个简单的方法来做到这一点。


I am adding a string (a) to another string (b) before I store it in DB, when I retrieve the value from DB, I want to remove the string(b) from string (a). string (b) is a constant. How can I do it

string a= "text1";
string b="text2";
string c = a+b;

I want to remove b from c after I retrive it from db

解决方案

c = c.Replace(b, "");

Would be a simple way to do so.

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

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