Text Encoding
-
I want to convert the CR & LN characters to and from their decimal values. so I would have a text variable set to "\r" and/or "\n" and I would want to display these values to the user as "13" and/or "10". Allow the user to changes these to other decimal values and convert back to the text equivalent for searching in strings. I have the convestion from decimal to character as follows, but what about the other way around ?
string Data = INI.GetINI("Settings","Seperator","/13/10");
string [] Seps = Data.Split('/');
string m_Sep=null;
foreach(string Sep in Seps)
{
if(Sep.Length==0)
continue;
m_Sep += (char)int.Parse(Sep);
} -
I want to convert the CR & LN characters to and from their decimal values. so I would have a text variable set to "\r" and/or "\n" and I would want to display these values to the user as "13" and/or "10". Allow the user to changes these to other decimal values and convert back to the text equivalent for searching in strings. I have the convestion from decimal to character as follows, but what about the other way around ?
string Data = INI.GetINI("Settings","Seperator","/13/10");
string [] Seps = Data.Split('/');
string m_Sep=null;
foreach(string Sep in Seps)
{
if(Sep.Length==0)
continue;
m_Sep += (char)int.Parse(Sep);
}Converting is easier than you think. Just use basic byte-char conversion: char one = '\r'; byte val = (byte)one; //result is a 13 char two = (char)val; //result is '\r'
-
Converting is easier than you think. Just use basic byte-char conversion: char one = '\r'; byte val = (byte)one; //result is a 13 char two = (char)val; //result is '\r'
thanks much