How to find and replace a specific word in string?(如何查找和替换字符串中的特定单词?)
问题描述
我只想用 RDLC 列中的空格替换特定文本.
I just want to replace a particular text with blank space in RDLC column.
我想在每个字符串中用 "" 替换 .aspx.
I want to replace .aspx with "" in every string.
我试着写
=Replace(Fields!AuditsUserActivity.Value, ".aspx", "")
它适用于这种线条
Page Applicants.aspx viewed
但不适用于这些行:
Data added in Inspectors.aspx
即它从那些 .aspx 出现在中间的行中删除了 .aspx,但没有删除 .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.
为什么?
更新:
我用过但没用
=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", "");
这篇关于如何查找和替换字符串中的特定单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何查找和替换字符串中的特定单词?
- 输入按键事件处理程序 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
