Class StringDecoratorExtensions
- Namespace
- Cuemon.Net
- Assembly
- Cuemon.Net.dll
Extension methods for the String class hidden behind the IDecorator<T> interface.
public static class StringDecoratorExtensions
- Inheritance
-
StringDecoratorExtensions
Remarks
Kudos to the mono-project team for this class. I only modified some of the original code to fit into this class. For the original code, have a visit here for the source code: https://github.com/mono/mono/blob/master/mcs/class/System.Web/System.Web/HttpUtility.cs or here for the mono-project website: http://www.mono-project.com/. Primary reason for including these methods: https://edi.wang/post/2018/11/25/netcore-webutility-urlencode-httputility-urlencode
Methods
UrlDecode(IDecorator<String>, Action<EncodingOptions>)
Converts the enclosed String of the specified decorator
that has been encoded for transmission in a URL into a decoded string.
public static string UrlDecode(this IDecorator<string> decorator, Action<EncodingOptions> setup = null)
Parameters
decorator
IDecorator<String>The IDecorator<T> to extend.
setup
Action<EncodingOptions>The EncodingOptions which may be configured.
Returns
- String
An URL decoded string.
Exceptions
- ArgumentNullException
decorator
cannot be null.
UrlEncode(IDecorator<String>, Action<EncodingOptions>)
Encodes a URL string from the enclosed String of the specified decorator
.
public static string UrlEncode(this IDecorator<string> decorator, Action<EncodingOptions> setup = null)
Parameters
decorator
IDecorator<String>The IDecorator<T> to extend.
setup
Action<EncodingOptions>The EncodingOptions which may be configured.
Returns
- String
An URL encoded string.
Exceptions
- ArgumentNullException
decorator
cannot be null.