Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

LinkedIn Learning

C#: String Essential Training

via LinkedIn Learning

Overview

Coursera Plus Annual Sale: All Certificates & Courses 25% Off!
Learn how to work with the string class in the .NET framework. Review how to manipulate string content, parse strings, format numeric and date types, and more.

Syllabus

Introduction
  • Working with text in .NET
  • How to access and clone the GitHub code
  • Open the cloned solution in Visual Studio
  • Work with Git branches
1. Overview
  • .NET, text, and strings
  • What is a string?
  • Declaring a string variable
  • Initialize a string variable
  • Immutable: What does that mean in .NET strings?
2. The Char Type
  • The char, the building block of a strong
  • Initialize a string from a char array
  • Get a char from a string
  • Use char methods to analyze Unicode data
3. String Basics
  • Three ways to work with string literals
  • Use escape sequences to add control chars to a string
  • Use verbatim string literals
4. Composing Strings
  • Combine strings with String.Concat
  • Combine strings with the concatenation operator
  • Composite formatting with placeholders
  • Use C# interpolation for simpler composite formatting
  • Use StringBuilder to improve performance
  • Use Perf Monitor to examine performance improvements
5. String Methods
  • Splitting strings into an array
  • Use LINQ to query string array
  • Joining an array into a string
  • Trim unwanted content from a string
  • Work with a subset of a string
  • Verify that string contains search characters
  • Replace and remove content
  • Challenge: Better substring
  • Solution: Better substring
6. How Custom Types Format and Parse Strings
  • Custom types and string conversions
  • How custom types are converted to string with toString()
  • How custom types override toString()
  • IFormattable and the toString() call order
  • Custom formats with IFormattable
  • Working with culture-specific formats
  • Challenge: Split a string into two numbers
  • Solution: Convert a string to the type with parse()
  • Add custom filters to parse()
  • Prevent exceptions with a tryParse() implementation
7. Formatting
  • Formatting data with the built-in numeric formats
  • Formatting data with custom formatters
  • Apply conditional string formats
  • Formatting dates
  • Challenge: Ordinal formatting
  • Solution: Ordinal formatting
8. Convert and Parse
  • The parse() method and the Convert class
  • Use tryParse() for better error handing
9. Culture Information
  • Why is culture important for strings?
  • The CultureInfo class
  • Use culture when formatting strings
  • Invariant culture and strings
10. Compare and Sort
  • How string comparison works in .NET
  • Test for equality with String.Equals
  • Compare strings with String.Compare
  • Sort strings with Array.Sort and LINQ
Conclusion
  • Next steps

Taught by

Walt Ritscher

Reviews

4.8 rating at LinkedIn Learning based on 64 ratings

Start your review of C#: String Essential Training

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.