如何查找和替换字符串一个特定的词吗? [英] How to find and replace a specific word in string?

查看:118
本文介绍了如何查找和替换字符串一个特定的词吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想以取代在RDLC栏空白处一个特定的文本。

我想在每一个字符串更换的.aspx。

我试着写

  =替换(领域!AuditsUserActivity.Value的.aspx,)

它为这个还挺行

 网​​页浏览Applicants.aspx

但这些还挺行:

 在Inspectors.aspx数据添加

即。它从其中的.aspx出现在两者之间,但不为那些其中.ASPX出现在字符串的末尾

的那些行删除的.aspx

为什么?

更新:

我用这个,但不工作

  =替换(领域!AuditsUserActivity.Value,@+。ASPX的String.Empty)


解决方案

像许多其他人所说,你应该尝试使用正则表达式的前pression。也许尝试正是这种复制:

  = System.Text.RegularEx pressions.Regex.Replace(!字段AuditsUserActivity.Value的.aspx,);

I just want to replace a particular text with blank space in RDLC column.

I want to replace .aspx with "" in every string.

I tried writing

=Replace(Fields!AuditsUserActivity.Value, ".aspx", "")

it works for this kinda lines

Page Applicants.aspx viewed 

but not for these kinda lines:

Data added in Inspectors.aspx

i.e. it removed .aspx from those lines in which .aspx appears in in-between but not for those in which .aspx appears at the end of string.

WHY ?

Update:

I used this but not working

=Replace(Fields!AuditsUserActivity.Value, "@"+".aspx", string.Empty)

解决方案

Like many others have suggested, you should try using a regex expression. Perhaps try copying this exactly:

=System.Text.RegularExpressions.Regex.Replace(Fields!AuditsUserActivity.Value, ".aspx", "");

这篇关于如何查找和替换字符串一个特定的词吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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