C# Uri UnescapeDataString

Description

Uri UnescapeDataString converts a string to its unescaped representation.

Syntax

Uri.UnescapeDataString has the following syntax.


public static string UnescapeDataString(
  string stringToUnescape
)

Parameters

Uri.UnescapeDataString has the following parameters.

  • stringToUnescape - The string to unescape.

Returns

Uri.UnescapeDataString method returns A String that contains the unescaped representation of stringToUnescape.

Example

The following code example unescapes a URI, and then converts any plus characters ("+") into spaces.


/*from w w  w  . ja  v  a 2 s .c  o  m*/
using System;
public class MainClass{
  public static void Main(String[] argv){  
    String DataString = Uri.UnescapeDataString(".NET+Framework");
    Console.WriteLine("Unescaped string: {0}", DataString);
    
    String PlusString = DataString.Replace('+',' ');
    Console.WriteLine("plus to space string: {0}", PlusString);

  }
}
    

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version