替换精确的URl或Word [英] Replace Exact URl or Word
问题描述
我的编辑器有像贝洛这样的内容。
测试网址
http://www.apple.com/
http://www.apple.com/ipod
http://www.apple.com / iphone /
在以上三行中,我想将http://www.applie.com替换为其他一些Url(http://www.google) .COM)。我使用替换功能来修改3行以上,如下所示
http://www.google.com/
http://www.google.com/ipod
http://www.google.com/iphone/
但我只想修改第一行而不是所有行
请给我任何关于此问题的建议。
谢谢,
Hi,
My editor have content like bellow.
Test URLs
http://www.apple.com/
http://www.apple.com/ipod
http://www.apple.com/iphone/
In the above three lines i want to replace http://www.applie.com to some other Url like(http://www.google.com). I Used Replace function to modifed above 3 lines to like bellow
http://www.google.com/
http://www.google.com/ipod
http://www.google.com/iphone/
But i want to modify only first Line not for all lines
please give me any suggestion for this issue.
Thanks,
推荐答案
string str="http://www.apple.com/";
if (TestURIStr.Equals(str)
{
string replacestr = TestURIStr.Replace(TestURIStr,"http://www.google.com/");
}
else
{
string replacestr = TestURIStr;
}
-NP
-NP
这篇关于替换精确的URl或Word的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!