The following sections discuss the string data type, which is an alias for the String class.
Using Strings (C# Programming Guide)
How to: Parse Strings Using the Split Method (C# Programming Guide)
How to: Search Strings Using String Methods (C# Programming Guide)
How to: Search Strings Using Regular Expressions (C# Programming Guide)
How to: Join Multiple Strings (C# Programming Guide)
How to: Modify String Contents (C# Programming Guide)
Basic String Operations
Comparing Strings
An easily overlooked feature of the String in C# is the Verbatim String Literal. By prefixing a string literal with "@", you can insert line breaks and other special characters into a string, and the C# compiler will interpret everything between the open and closing quotation marks as the contents of that string. Note that quotation marks within the string need to be doubled, or else the compiler will assume it has hit the end of the string literal.
Example:
string script = @"<script language='javascript'> function SelectedValue(selectBox, valueToSelect) { if (selectBox.options.length > 0) { for (var i = 0; i < selectBox.options.length; i++) { var currentOpt = selectBox.options[i];
if (currentOpt.value == valueToSelect) { selectBox.selectedIndex = i; alert(""Found a match!""); break; } } } } </script>";