Authlete
TextUtility Class Reference

Text utility. More...

Static Public Member Functions

static string Base64Encode (string plainText)
 Convert a plain text into a Base64-encoded string. More...
 
static string Base64Decode (string base64String)
 Convert a Base64-encoded string into a plain text. More...
 
static string UrlEncode (string plainText)
 Convert a plain text into a URL-encoded string. More...
 
static string UrlDecode (string encodedString)
 Convert a URL-encoded string into a plain text. More...
 
static ? int HexToInt (char c)
 Convert a character which represents a hex digit (0-9, A-F, a-f) to an integer (from 0 to 15). If the given character is not a hex digit, null is returned. More...
 
static T FromJson< T > (string json)
 Convert a JSON string into an object. More...
 
static string ToJson (object obj)
 Convert an object into a JSON string. More...
 
static bool EqualsIgnoreCase (string s1, string s2)
 Compare two strings with the OrdinalIgnoreCase rule and returns true if they are equal. More...
 

Detailed Description

Text utility.

Member Function Documentation

◆ Base64Decode()

static string Base64Decode ( string  base64String)
inlinestatic

Convert a Base64-encoded string into a plain text.

Returns
A plain text.
Parameters
base64StringA Base64-encoded string. If null is given, null is returned.

◆ Base64Encode()

static string Base64Encode ( string  plainText)
inlinestatic

Convert a plain text into a Base64-encoded string.

Returns
A Base64-encoded string.
Parameters
plainTextA plain text. If null is given, null is returned.

◆ EqualsIgnoreCase()

static bool EqualsIgnoreCase ( string  s1,
string  s2 
)
inlinestatic

Compare two strings with the OrdinalIgnoreCase rule and returns true if they are equal.

◆ FromJson< T >()

static T FromJson< T > ( string  json)
inlinestatic

Convert a JSON string into an object.

Returns
An object.
Parameters
jsonA JSON string. If null is given, the default value of the type is returned.
Template Parameters
TThe type of the output object.

◆ HexToInt()

static ? int HexToInt ( char  c)
inlinestatic

Convert a character which represents a hex digit (0-9, A-F, a-f) to an integer (from 0 to 15). If the given character is not a hex digit, null is returned.

Parameters
cA hex digit (0-9, A-F, a-f).

◆ ToJson()

static string ToJson ( object  obj)
inlinestatic

Convert an object into a JSON string.

Returns
A JSON string.
Parameters
objAn object. If null is given, null is returned.

◆ UrlDecode()

static string UrlDecode ( string  encodedString)
inlinestatic

Convert a URL-encoded string into a plain text.

Returns
A plain text.
Parameters
encodedStringA URL-encoded string. If null is given, null is returned.

◆ UrlEncode()

static string UrlEncode ( string  plainText)
inlinestatic

Convert a plain text into a URL-encoded string.

Returns
A URL-encoded string.
Parameters
plainTextA plain text. If null is given, null is returned.

The documentation for this class was generated from the following file: