2014-07-22 202 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