C# Class Platform.StringUriUtils

Provides useful methods for dealing with string based URIs.
Show file Open project: platformdotnet/Platform

Public Properties

Property Type Description
AcceptableSeperatorChars char[]

Public Methods

Method Description
AppendQueryPart ( string uri, string key, string value ) : string
BuildQuery ( NameValueCollection nameValueCollection ) : string
BuildQuery ( NameValueCollection nameValueCollection, string>.Predicate acceptPair ) : string
BuildQuery ( string>.System pairs ) : string
BuildQuery ( string>.System pairs, string>.Predicate acceptPair ) : string
Combine ( string left, string right ) : string
ContainsQuery ( string uri ) : bool
Escape ( string s, Predicate includeChar ) : string
GetName ( string uri ) : string

Returns the name part of a URL

GetPath ( string uri ) : string
GetScheme ( string uri ) : string
GetSchemeAndPath ( string uri ) : string>.Pair
NormalizePath ( string path ) : string

NormalizePath(string, int, int)

Calls NormalizePath(string, int, int) with the array AcceptableSeperatorChars which contains '/' and '\'.

NormalizePath ( string path, int startIndex, int count ) : string
NormalizePath ( string path, int startIndex, int count, char seperatorChars, bool preserveEndingSeperator ) : string

Normalises a given path and returns the new normalised version.

The normalization process consists of the following: Path elements consisting of '.' are removed. Path elements before path elements consisting of '..' are removed. The given chars are replaced with the standard URI seperator char '/'.

Paths will always be returned without the trailing seperator char '/'.

ParseQuery ( string query ) : IEnumerable>,System.Collections.Generic
RemoveQuery ( string uri ) : string
Unescape ( string s ) : string
UrlEncode ( string instring ) : string

Private Methods

Method Description
CharArrayContains ( char array, char c ) : bool

Method Details

AppendQueryPart() public static method

public static AppendQueryPart ( string uri, string key, string value ) : string
uri string
key string
value string
return string

BuildQuery() public static method

public static BuildQuery ( NameValueCollection nameValueCollection ) : string
nameValueCollection System.Collections.Specialized.NameValueCollection
return string

BuildQuery() public static method

public static BuildQuery ( NameValueCollection nameValueCollection, string>.Predicate acceptPair ) : string
nameValueCollection System.Collections.Specialized.NameValueCollection
acceptPair string>.Predicate
return string

BuildQuery() public static method

public static BuildQuery ( string>.System pairs ) : string
pairs string>.System
return string

BuildQuery() public static method

public static BuildQuery ( string>.System pairs, string>.Predicate acceptPair ) : string
pairs string>.System
acceptPair string>.Predicate
return string

Combine() public static method

public static Combine ( string left, string right ) : string
left string
right string
return string

ContainsQuery() public static method

public static ContainsQuery ( string uri ) : bool
uri string
return bool

Escape() public static method

public static Escape ( string s, Predicate includeChar ) : string
s string
includeChar Predicate
return string

GetName() public static method

Returns the name part of a URL
public static GetName ( string uri ) : string
uri string
return string

GetPath() public static method

public static GetPath ( string uri ) : string
uri string
return string

GetScheme() public static method

public static GetScheme ( string uri ) : string
uri string
return string

GetSchemeAndPath() public static method

public static GetSchemeAndPath ( string uri ) : string>.Pair
uri string
return string>.Pair

NormalizePath() public static method

NormalizePath(string, int, int)
Calls NormalizePath(string, int, int) with the array AcceptableSeperatorChars which contains '/' and '\'.
public static NormalizePath ( string path ) : string
path string
return string

NormalizePath() public static method

public static NormalizePath ( string path, int startIndex, int count ) : string
path string
startIndex int
count int
return string

NormalizePath() public static method

Normalises a given path and returns the new normalised version.

The normalization process consists of the following: Path elements consisting of '.' are removed. Path elements before path elements consisting of '..' are removed. The given chars are replaced with the standard URI seperator char '/'.

Paths will always be returned without the trailing seperator char '/'.

public static NormalizePath ( string path, int startIndex, int count, char seperatorChars, bool preserveEndingSeperator ) : string
path string /// The path to normalise. ///
startIndex int
count int
seperatorChars char
preserveEndingSeperator bool
return string

ParseQuery() public static method

public static ParseQuery ( string query ) : IEnumerable>,System.Collections.Generic
query string
return IEnumerable>,System.Collections.Generic

RemoveQuery() public static method

public static RemoveQuery ( string uri ) : string
uri string
return string

Unescape() public static method

public static Unescape ( string s ) : string
s string
return string

UrlEncode() public static method

public static UrlEncode ( string instring ) : string
instring string
return string

Property Details

AcceptableSeperatorChars public static property

Array of standard acceptable seperator chars for use when normalizing a path.
This array holds the chars '/' and '\'.
public static char[] AcceptableSeperatorChars
return char[]