This C# Utility will guide you to Convert a string into character. Just pass a string value into this utility and and it will return a char string if conversion is successful other wise return a blank ‘ ’ char.
/// <summary>
/// PURPOSE: To convert a string to char. if error in conversion, it will bring back ' '.
/// </summary>
/// <param name="pStrValue"></param>
/// <returns></returns>
public static char getpropercharvalue(string pStrValue)
{
char returnValue = ' ';
try
{
returnValue = char.Parse(pStrValue);
}
catch
{
returnValue = ' ';
}
return returnValue;
}
No comments:
Post a Comment