Convert Char[] Array To String Convert Char To Character Value or For each char in a string
Category: Strings
Byte Array Strings
String Direct To Byte Array Byte Array To String
Convert Values From A String
Convert 2 Digit Hex To Byte byte MyByte = byte.Parse(MyString.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
Display Values In A String
Display value formatted to 2 decimal places double value = (double)12.3; string MyString = value.ToString(“#0.00”); //MyString will be “12.30”
Converting Strings
HTML Encode / Decode strings string MyString = “<hello>”; MyString = WebUtility.HtmlEncode(MyString); string MyString = “<hello>”; MyString = WebUtility.HtmlDecode(MyString);
Working With Strings
Read individual characters from a string Treat the string as an array string MyString = “abcd”; char MyChar = MyString[2]; Get Characters Between Markers Within String string sTemp = responseStr; string StartAfterChars; string EndBeforeChars; int Start; int Length; string FoundString; StartAfterChars = “<requestID>”; EndBeforeChars = “</requestID>”; Start = sTemp.IndexOf(StartAfterChars) + StartAfterChars.Length; Length = sTemp.IndexOf(EndBeforeChars) – […]
.Strings General
string or String string is an alias in C# for System.String.So technically there is no difference (it’s like int and System.Int32). Best practice: Use string any time you’re referring to an object. Use String if you need to refer specifically to the class. Multi Line Strings Use the ‘@’ character before the string to create […]