用空值替换“ [英] Replacing ' with null

查看:79
本文介绍了用空值替换“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

插入xpatjobs_area_city(area_id,type,name)值(143,''city'',''isola d''istria'');
插入xpatjobs_area_city(area_id,type,name)值(143,``city'',''d``isria'');
插入xpatjobs_area_city(area_id,type,name)值(143,``city'',``ISO d'iuitria'')
;
插入xpatjobs_area_city(area_id,type,name)值(143,``city'',``ijuid''iskjitria'');
插入xpatjobs_area_city(area_id,type,name)值(143,``city'',``riad''istia'');


我想将''替换为空白,我尝试使用常规expsn替换文本
使用文本编辑器
([a-zA-Z])''([a-zA-Z])

但它为"isola d" istria选择了d''i

我有一个完整的段落来替换

insert into xpatjobs_area_city (area_id,type,name) values(143,''city'',''isola d''istria'');
insert into xpatjobs_area_city (area_id,type,name) values(143,''city'',''d ''isria'');
insert into xpatjobs_area_city (area_id,type,name) values(143,''city'',''ISO d''iuitria'')
;
insert into xpatjobs_area_city (area_id,type,name) values(143,''city'',''ijuid''iskjitria'');
insert into xpatjobs_area_city (area_id,type,name) values(143,''city'',''riad''istia'');


i want to replace '' with blank i tried to replace the text using regular expsn
using text editor
([a-zA-Z])''([a-zA-Z])

but it selects a d''i for ''isola d''istria

i have a full paragraph to replace

推荐答案

我在C#中尝试过,并且工作正常.

I tried this in C# and it worked fine.

Regex regex = new Regex("\'");
string[] lines = File.ReadAllLines("d:\\milind.txt");
foreach (string line in lines)
{
  string str = regex.Replace(line, "");
  Console.WriteLine(str);
}



希望能有所帮助.如果是这样,请将其标记为答案/赞.
我已替换为空格,如果您只想删除",则可以使用".

Milind



Hope that helps. If it does, mark it as answer/upvote.
I have replaced with space you can use "" if you simply want to remove ''.
or
Milind


在C#中
如果要将('')替换为空白
In C#
If you want to replace the ('') with blank
string name=name.Replace("'","");



如果您不想替换('')



If you don''t want to replace the ('')

string name=name.Replace("'","''");



在SQL
如果要将('')替换为空白



In SQL
If you want to replace the ('') with blank

print replace('isola d''istria','''','')


这篇关于用空值替换“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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