c# - 用于从字符串中删除字符序列的String方法

标签 c# string

如果我有:

string st1 = "this.is.a.string.type";
string st2 = "string";


如果st1中存在确切的字符序列,是否有任何内置的String方法从st1中删除st2?所以我想以“ this.is.a..type”结尾。

最佳答案

最简单的是:

st1 = st1.Replace(st2, "");


但这并不一定非常有效。

关于c# - 用于从字符串中删除字符序列的String方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5078907/

相关文章:

android - 根据用户偏好加载资源

c++ - 用一个空格替换字符串中的多个空格

python - 检查python中的srt文件中是否存在原始数据的任何元素

c# - ConcurrentDictionary - 将 addValueFactory (Func<string, T, T> ) 转换为 updateValueFactory (Func<string, T, T>)?

c# - 多个显式接口(interface)实现

c# - 服务器在区域设置中设置为 en-GB,但 DateTime 解析为 en-US

c# - 如何将包含数组的结构转换为字节数组?

python - 可以直接将文件内容加载到 protobuf 中吗?

c++ - std::string s() 奇怪的行为

c# - Entity Framework /Linq to SQL : Skip & Take