2010-06-08 110 views
0

我只是漫步在哪裏可以找到一個工具,它在我的情況下是java腳本字符串是
unescape並將其轉換爲轉義字符串,所以我可以使用它作爲字符串值C++正在尋找工具將unescape字符串轉換爲轉義字符串

例如「我需要將它轉換爲\」的字符
我需要一些聰明的東西,而不僅僅是替換所有的功能。

+0

http://rishida.net/tools/conversion/ – user63898 2010-06-08 10:22:29

回答

0

僞代碼類似於C:

while(got_input_data) 
{ 
    char = getFirstChar(); 
    if(char == '\"') 
    { 
     putchar('\'); 
     putchar('\"'); 
    } 
    else if(another character that must be escaped) 
    { 
     // do similar stuff 
    } 
    else 
    { 
     // simply print the char that doesn't need to be escaped 
     putchar(char); 
    } 
} 

我不知道是否存在這樣的工具,但我必須承認,我寫了類似的東西,當我需要把一個html頁面作爲一個字符串放在用C寫成的CGI中。過去...