2014-07-22 154 views
-3

我是C#的初学者。 我试图使搜索&一个小工具更换c#搜索和替换

我有这个输入:

"name" => "Hello world",  

我想这样的输出:

'name' =>__('Hello world','$Variable'), 

这是我的尝试:

private string ReplaceBackgroundDirection(string Source) 
     { 
Source = Source.Replace("name", "name"); 
Source = Source.Replace("=>"+"", "=> __("); 
+0

我不明白你的问题,请尝试定义你想要的... –

回答

4

我猜你想要返回替换的字符串:

private string ReplaceBackgroundDirection(string Source) 
{ 

    return Source.Replace("\"", "'").Replace("=>","=>__(") + "'$Variable'),"; 
} 
+2

+1为了能够读心术 – developerwjk

+0

非常感谢您@celerno :)但为什么我得到负面的评级:( – user3690026

+0

你的问题的拼写和语法需要很多改进。我猜想,英语人士很难理解你想说什么。阅读此:http://stackoverflow.com/help/how-to-ask。这不会浪费时间。 – celerno