From the course: Nail Your C# Interview
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Access data from strings - C# Tutorial
From the course: Nail Your C# Interview
Access data from strings
- [Instructor] A common programming task is to search for a piece of data within a string. Depending on the assumptions you make about a string's data you can make an algorithm more or less efficient. If you know nothing about the string you have to check every piece of data within the string in order to find the data you're searching for. If you know the string has its characters in a sorted order then you can optimize the algorithm by starting your search in the front, back, or middle of the string. In all of these cases you'll need to parse the data within the string in order to find the character or substring you're looking for. Let's take a look at how to do that in C#. The least complex, but also least efficient way, to search for a subset of characters within a string is to use the built-in Contains method. We use the Contains method by accessing the string, in this case input, and we say .Contains. We'll see if it…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Concatenate strings with different methods2m 49s
-
(Locked)
Normalize string input4m 55s
-
(Locked)
Validate string input6m 47s
-
(Locked)
Access data from strings7m 30s
-
(Locked)
Create algorithm-driven strings in C#7m
-
(Locked)
Solution: Developing a palindrome checker3m 38s
-
(Locked)
Solution: Reverse each word2m 15s
-
-
-
-
-