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”  

Read More

Converting Strings

HTML Encode / Decode strings string MyString = “<hello>”; MyString = WebUtility.HtmlEncode(MyString); string MyString = “&lt;hello&gt;”; MyString = WebUtility.HtmlDecode(MyString);  

Read More

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) – […]

Read More

.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 […]

Read More