Converting


String to Integer


int i; 
i = (int)myString;
i = (System.Int32)myString;
i = myString as int;
i = myString as System.Int32;
i = System.Convert.ToInt32(myString);
i = System.Int32.Parse(myString);

Integer to String


int i = 10; 
string s;
s = i.ToString();
s = System.Convert.ToString(i);
s = System.String.Format("{0}",i);
s = $"{i}";
s = "" + i;
s = System.String.Empty + i;
s = new System.Text.StringBuilder().Append(i).ToString();

Character Codes

All strings in .NET are stored as 16-bit Unicode characters.
Encoding is the process of transforming a set of Unicode characters into a different character set
Decoding is the process of transforming a different character set into a set of Unicode characters.


System.Text.Ascii



System.Text.ASCIIEncoding



System.Text.Encoding


This encodes a set of characters into a sequence of bytes.

byte[] bytes = System.Text.Encoding.Default.GetBytes(textBefore); 

Remove all the non UTF8 characters from a string.
You can use encoding which is the process of transforming a set of Unicode characters into a sequence of bytes.


string textAfter = System.Text.Encoding.UTF8.GetString(textBefore); 

System.Text.UTF8Encoding



© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext