在软件开发领域,字符串是一系列字符。不管你使用哪种编程语言,它都将是最重要的数据类型之一。在本课程中,Walt Ritscher着重研究了如何使用字符串类。Walt回顾了如何处理字符串内容、解析字符串、设置数字和日期类型的格式等等。另外,他介绍了文化差异对字符串的影响,并展示了如何使用CultureInfo类。


  • 声明和初始化字符串变量
  • 从字符串获取字符
  • 使用字符的方法分析Unicode数据
  • 使用字符串文字的三种方法
  • 组合字符串
  • 将字符串拆分成数组
  • 如何自定义类型格式化和解析字符串
  • 格式化数字和日期类型
  • 比较和排序


  • 英文名称:C#: String Essential Training
  • 时长:3小时8分
  • 字幕:英语


  1. Working with text in .NET
  2. How to access and clone the GitHub code
  3. Open the cloned solution in Visual Studio
  4. Work with Git branches
  5. .NET, text, and strings
  6. What is a string?
  7. Declaring a string variable
  8. Initialize a string variable
  9. Immutable: What does that mean in .NET strings?
  10. The char, the building block of a strong
  11. Initialize a string from a char array
  12. Get a char from a string
  13. Use char methods to analyze Unicode data
  14. Three ways to work with string literals
  15. Use escape sequences to add control chars to a string
  16. Use verbatim string literals
  17. Combine strings with String.Concat
  18. Combine strings with the concatenation operator
  19. Composite formatting with placeholders
  20. Use C# interpolation for simpler composite formatting
  21. Use StringBuilder to improve performance
  22. Use Perf Monitor to examine performance improvements
  23. Splitting strings into an array
  24. Use LINQ to query string array
  25. Joining an array into a string
  26. Trim unwanted content from a string
  27. Work with a subset of a string
  28. Verify that string contains search characters
  29. Replace and remove content
  30. Challenge: Better substring
  31. Solution: Better substring
  32. Custom types and string conversions
  33. How custom types are converted to string with toString()
  34. How custom types override toString()
  35. IFormattable and the toString() call order
  36. Custom formats with IFormattable
  37. Working with culture-specific formats
  38. Challenge: Split a string into two numbers
  39. Solution: Convert a string to the type with parse()
  40. Add custom filters to parse()
  41. Prevent exceptions with a tryParse() implementation
  42. Formatting data with the built-in numeric formats
  43. Formatting data with custom formatters
  44. Apply conditional string formats
  45. Formatting dates
  46. Challenge: Ordinal formatting
  47. Solution: Ordinal formatting
  48. The parse() method and the Convert class
  49. Use tryParse() for better error handing
  50. Why is culture important for strings?
  51. The CultureInfo class
  52. Use culture when formatting strings
  53. Invariant culture and strings
  54. How string comparison works in .NET
  55. Test for equality with String.Equals
  56. Compare strings with String.Compare
  57. Sort strings with Array.Sort and LINQ
  58. Next steps