Loading...
Searching...
No Matches
PixelCrushers.SafeConvert Class Reference

Conversion methods that return default values instead of throwing exceptions. More...

Static Public Member Functions

static int ToInt (string s)
 Converts a string to an int.
 
static float ToFloat (string s)
 Converts a string to a float.
 
static string ToSerializedElement (string s)
 Sanitizes a string so it can be serialized to string-based serialization systems.
 
static string FromSerializedElement (string s)
 Desanitizes a string that was previously sanitized for use in string-based serialization systems.
 

Detailed Description

Conversion methods that return default values instead of throwing exceptions.

Member Function Documentation

◆ FromSerializedElement()

static string PixelCrushers.SafeConvert.FromSerializedElement ( string  s)
inlinestatic

Desanitizes a string that was previously sanitized for use in string-based serialization systems.

Parameters
sSanitized version.
Returns
Original source string.

◆ ToFloat()

static float PixelCrushers.SafeConvert.ToFloat ( string  s)
inlinestatic

Converts a string to a float.

Parameters
sSource string.
Returns
float value, or 0 on conversion failure.

◆ ToInt()

static int PixelCrushers.SafeConvert.ToInt ( string  s)
inlinestatic

Converts a string to an int.

Parameters
sSource string.
Returns
int value, or 0 on conversion failure.

◆ ToSerializedElement()

static string PixelCrushers.SafeConvert.ToSerializedElement ( string  s)
inlinestatic

Sanitizes a string so it can be serialized to string-based serialization systems.

Parameters
sSource string.
Returns
Sanitized version.

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