String.Replace in C# [英] String.Replace in C#

查看:72
本文介绍了String.Replace in C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个像''AB'CD''E'这样的字符串。

我想用空字符串替换'。

2单引号应该在一起不要更换。

最后的字符串应为ABCD''E。



请帮助

I have a string like "'AB'CD''E'".
I want replace ' from the string with empty.
2 single quotes together should not be replaced.
Final string should be "ABCD''E".

Please help

推荐答案

没有了解您的代码就无法帮助

请参阅这些链接以了解其工作方式

double-quote-string-replace-in-c-sharp

C#替换
Without Knowing Your Code it is impossible to Help
See these Links to know how it works
double-quote-string-replace-in-c-sharp
C# Replace


更好的选择是正则表达式。它们位于 System.Text.RegularExpressions 命名空间中。习惯它们需要一些时间,但它们是一个非常有价值的字符串操作工具。
A better option is a regular expression. They are found in the System.Text.RegularExpressions namespace. It takes a little to get accustomed to them, but then they are an incredibly valuable tool for string manipulations.


这篇关于String.Replace in C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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