CodeBase.Replace忽略大小写 [英] CodeBase.Replace Ignore case
本文介绍了CodeBase.Replace忽略大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码:
assembly.CodeBase.Replace(assembly.ManifestModule.Name,")
替换区分大小写.
I have the following code:
assembly.CodeBase.Replace(assembly.ManifestModule.Name, "")
Replace is case sensitive. Is there an alternative to make it ignore case?
推荐答案
请参阅我对问题的评论.
因此,我不完全理解为什么要做这种奇怪的事情.甚至更少的您为什么要以不区分大小写的方式进行操作.我认为这没有任何意义.基于我的猜测,请考虑一下:
Please see my comment to the question.
So, I don''t fully understand why doing such weird thing; and even less why would you want to do it in a case-insensitive way. I don''t think it makes any sense. As a hint based on my guesswork, think about this:
Assembly someAssembly = //...
string executableModuleName = assembly.Location;
string executablePath = System.IO.Path.GetDirectoryName(executableModuleName);
怎么样?
How about it?
您可以使用正则表达式替换:
You can use the Regex replace:
Regex.Replace(string, string, string, RegexOptions.IgnoreCase);
这篇关于CodeBase.Replace忽略大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文