Содержание
- 2. What can we use ? 2. Formatting expressions — using a couple of useful interfaces, IFormatProvider
- 3. System.String System.String is a class that is specifically designed to store a string, and allow a
- 4. Declaration of string // Simple declaration string MyString = "Hello World";// Strings can include esca pe
- 5. Manipulating Strings The string class provides a host of methods for comparing, searching, and manipulating strings,
- 6. Manipulating Strings int result;//c o mpare two strings, case sen sitiv eresult = s tring .
- 7. Splitting Strings // create some strings to work withstring s1 = "On e,Two ,Three Libe rty
- 8. string object is an immutable Do you know when we do like that we are assigning
- 9. Dynamic Strings (class StringBuilder) The System.Text.StringBuilder class is used for creating and modifying strings. Unlike String,
- 10. StringBuilder Then, on calling the Append() method, the remaining text is placed in the empty space,
- 11. StringBuilder members The StringBuilder class has two main properties: Length - indicates the length of the
- 12. StringBuilder members The following table lists the main StringBuilder methods.
- 13. Regular Expressions Regular expressions are Patterns that can be used to match strings. Regular expressions are
- 14. Regular Expressions using System.Text;using S ystem.T ext.RegularExpressions;string text = Consol e.Rea dLine();str ing r e Task:
- 15. Text: Anna Jones and a friend went to lunch Regex: went Matches: Anna Jones and a
- 16. //matches any three char a cters w here the second character is 'a', 'b', 'c' or
- 17. Metacharacters and their Description
- 18. Examples using System;using Sy s tem.Text.RegularE xpressions;// First we see the input string. string input =
- 20. Скачать презентацию