Uri.UnescapeDataString(String) 方法
定義
將字串轉換成它的未逸出表示。Converts a string to its unescaped representation.
public:
static System::String ^ UnescapeDataString(System::String ^ stringToUnescape);
public static string UnescapeDataString (string stringToUnescape);
static member UnescapeDataString : string -> string
Public Shared Function UnescapeDataString (stringToUnescape As String) As String
參數
- stringToUnescape
- String
不要逸出的字串。The string to unescape.
傳回
stringToUnescape
的已取消逸出表示。The unescaped representation of stringToUnescape
.
例外狀況
stringToUnescape
為 null
。stringToUnescape
is null
.
範例
下列程式碼範例會將 URI,然後將任何加號字元 ( "+" ) 轉換為空格。The following code example unescapes a URI, and then converts any plus characters ("+") into spaces.
String DataString = Uri.UnescapeDataString(".NET+Framework");
Console.WriteLine("Unescaped string: {0}", DataString);
String PlusString = DataString.Replace('+',' ');
Console.WriteLine("plus to space string: {0}", PlusString);
備註
您應該小心使用這個方法。You should use this method with care. 未逸出先前未經過非工作字串的字串可能會導致不明確和錯誤。Unescaping a string that has been previously unescaped can lead to ambiguities and errors.
許多網頁瀏覽器會將 Uri 內的空格換成加號 ( "+" ) 字元;但是,System.uri.unescapedatastring 方法不會將加號字元轉換成空格,因為在所有的 URI 配置中,這種行為不是標準的。Many Web browsers escape spaces inside of URIs into plus ("+") characters; however, the UnescapeDataString method does not convert plus characters into spaces because this behavior is not standard across all URI schemes.